学习链接
学习链接2
#-*-coding:utf8-*-
import pickle
class testdump:
def __init__(self,id,name):
self.id=id
self.name=name
def __dict__(self):
return {'id':self.id,'name':self.name}
test=testdump("1","ls")
file=open("text.txt","wb")
result=pickle.dumps(test)
result=pickle.loads(result)
print("result",result.id)
pickle模块介绍如下:
模块介绍