pickle

pickle 模块的简易使用

序列化存储

1
2
3
4
import pickle
data = ...
f = open('file.pkl','wb')
pickle.dump(data, f)

序列化读取

1
2
3
import pickle
pkl_file = open('file.pkl','rb')
data = pickle.load(pkl_file)
Donate comment here