import pickle
def save_pkl(path,obj):
pickle_file = open(path,'wb')
pickle.dump(obj, pickle_file)
pickle_file.close()
print(" Saved successfully ")
def load_pkl(path):
pickle_file = open(path,'rb')
obj=pickle.load(pickle_file)
pickle_file.close()
print(" Read successful ")
return obj
a=[1,2,3,4]
save_pkl("./list_a.pkl",a)
Take personal notes only for easy viewing
Reference resources :
https://zhuanlan.zhihu.com/p/104492767?from_voters_page=true