pickle —— Python 对象序列化

2019-07-17  本文已影响0人  MayerBin

pickle模块的运用

import pickle
data = {'a':1, 'b': 2}
# 写入
with open('data.pkl', 'wb') as f:
    pickle.dump(data, f)

# 读取
with open('data.pkl', 'rb') as f1:
    print(pickle.load(f1))

更多学习链接:https://blog.csdn.net/sxingming/article/details/52164249

https://blog.csdn.net/coffee_cream/article/details/51754484

https://docs.python.org/zh-cn/3/library/pickle.html#module-pickle

上一篇 下一篇

猜你喜欢

热点阅读