把json的数据写入到文件中
import json with open('data.json','w+') as f: json.dump({"name":"张彪"},f)
把json的数据从文件中读取出来
import json with open('data.json','r') as f: x=json.load(f) print(x,type(x))
import json with open('data.json','w+') as f: json.dump({"name":"张彪"},f)
import json with open('data.json','r') as f: x=json.load(f) print(x,type(x))