pickle模块是对Python对象结构进行二进制序列化和反序列化的协议实现.
pickle可以把字典、列表等结构化数据存到本地文件,读取后返回的还是字典、列表等结构化数据
import pickle
a = {'name':'Major','age':22}
with open('text.txt','wb') as file:
pickle.dump(a,file)
with open('text.txt','rb') as file2:
b = pickle.load(file2)
print(type(b))