[]Python][simple]Serialize data with Pickle and deserialize data from pickle

Posted jbite9057

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[]Python][simple]Serialize data with Pickle and deserialize data from pickle相关的知识,希望对你有一定的参考价值。

 

序列化

import pickle

friend = {"Dan": [20, "Lodon", 123123], "Mary" : [24, "Madi", 333333]}

with open("friend.dat", "wb") as f:
    pickle.dump(friend, f)

反序列化

with open("friend.dat", "rb") as f:
    obj = pickle.load(f)
     print(obj)

以上是关于[]Python][simple]Serialize data with Pickle and deserialize data from pickle的主要内容,如果未能解决你的问题,请参考以下文章

[Python] Simple Decorators

pythonのsimple_tag

python 使用Python和Simple-Crypt加密/解密

python dbhelper(simple orm)

Python 包装器“python-amazon-simple-product-api”用于在亚马逊上创建新购物车

python ZIPLINE RUN SIMPLE PIPELINE