序列化
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)
jbite9057 2019-12-31 09:34 原文
序列化
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)