python
将字典转换为json文件
import json
import codes
def save_jsonfile():
json_content = {}
#获取坐标
json_content['x'] = CapturePosition[0]
...
# 存入json文件
final_json = json.dumps(json_content, ensure_ascii=False)
with codecs.open ("d:\\data_json.json",'a','utf-8') as file:
file.write(final_json)
网友评论