import pickle d1={‘a‘:234,‘b‘:[3,5,7],‘w‘:[4,5]} #存储数据 f=open(r‘D:\matplotlib绘图\aaa.pickle‘,‘wb‘) pickle.dump(d1,f) f.close() #读取数据 with open(r‘D:\matplotlib绘图\aaa.pickle‘,‘rb‘) as f1: d2=pickle.load(f1) print(d2) {‘a‘: 234, ‘b‘: [3, 5, 7], ‘w‘: [4, 5]}
原文:https://www.cnblogs.com/luckiness/p/13166466.html