Pickle存放数据

介绍演示

import pickle
a_dict = {'da':111,2:[23,1,4],'23':{1:2,'d':'sad'}}

file = open('pickle_example.pickle','wb')

pickle.dump(a_dict,file)

file.close()

with open('pickle_example.pickle','rb') as file:

file = open('pickle_example.pickle','rb')

a_dict1 = pickle.load(file)

file.close()

print(a_dict1)

你可能感兴趣的:(Pickle存放数据)