pickle的用法

  • Post author:
  • Post category:其他


import pickle

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

# 保存
file = open('pickle_example.pickle', 'wb')
pickle.dump(a_dict, file)
file.close()

# 读取
file = open('pickle_example.pickle', 'rb')
a_dict1 = pickle.load(file)
file.close()
print(a_dict1)



版权声明:本文为qq_32005671原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。