用json来保存配置
- 编程
- 2021-05-11
- 1488
import json
config = {'key1': 'value1', 'key2': 'value2'}
with open('a_test\config.json', 'w') as f: # 保存配置文件
json.dump(config, f)
with open('a_test\config.json', 'r') as f: # 加载配置文件
config = json.load(f)
print(config)
print(type(config))上一篇:pyside2界面模板
发表评论