直接调用json,然后使用load方法读,dump方法写
json.dump(obj, fp)
json.load(fp)
import jsonf = open('dd.txt', 'rw')j = json.load(f) # 读文件json.dump(j, f) # 写文件f.close()