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:\mat ...
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]}