|
dic = {'a': 1, 'b': 2, 'c': 3, 'd': 1}
# save to local
f = open("..\\data\\dict.txt", 'w')
f.write(str(dic))
f.close()
print("save dict successfully.")
# read from local
f = open("..\\data\\dict.txt", 'r')
dict_ = eval(f.read())
f.close()
print("read from local : ", dict_)
|
|