import json
js = json.dumps(dic) file = open('test.txt', 'w') file.write(js) file.close()
file = open('test.txt', 'r') js = file.read() dic = json.loads(js) file.close()