pyjavaproperties.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:properties-editor 作者: dominikgiermala 项目源码 文件源码
def store(self, out, header=""):
        """ Write the properties list to the stream 'out' along
        with the optional 'header' """

        if out.mode[0] != 'w':
            raise ValueError('Steam should be opened in write mode!')

        try:
            #out.write(''.join(('#',header,'\n')))
            # Write timestamp
            #tstamp = time.strftime('%a %b %d %H:%M:%S %Z %Y', time.localtime())
            #out.write(''.join(('#',tstamp,'\n')))
            # Write properties from the pristine dictionary

            for key, value in sorted(self._origprops.items()):
                line = ''.join((key,'=',self.escape(value)))
                if not line.endswith('\n'):
                    line += '\n'
                out.write(line)

            out.close()
        except IOError as e:
            raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号