📅  最后修改于: 2022-03-11 14:45:22.577000             🧑  作者: Mango
import pickle
myobj = MyObj()
# save obj to file
with open('myfile.pkl', 'wb') as f:
pickle.dump(myobj, f)
# read obj from file
with open('myfile.pkl', 'wb') as f:
obj = pickle.load(f)