import json #导入JSON模块 with open('data.json',encoding='utf-8') as json_file: #读取JSON文件 py_obj=json.load(json_file) #JSON文件读取到字典 with open('data1.json','w') as json_wfile: #写文件 json.dump(py_obj,json_wfile) #将字典写入json文件中