settings.py 文件源码

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

项目:uPyLoader 作者: BetaRavener 项目源码 文件源码
def save(self):
        config_file = RelativePathResolver().absolute("config.json")
        try:
            # Check if file exists (supports also hidden files)
            if os.path.isfile(config_file):
                # Use write mode that also works with hidden files
                with open(os.open(config_file, os.O_WRONLY | os.O_TRUNC), 'w') as file:
                    json.dump(self.serialize(), file)
            else:
                # Simply create a new file
                with open(config_file, "w") as file:
                    json.dump(self.serialize(), file)
        except IOError:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号