pickle module: convert all Python objects into a binary file storage
Scenario: programming, preferably large objects (list, dictionaries, collections, etc.) written in the permanent pickle packet for program calls, instead of writing the program directly
Writing process: the list is converted to a binary file written my_pickle
import pickle
list=[1,2,3]
pickle_file = open('my_pickle.pkl','wb')
pickle.dump(list,pickle_file)
pickle_file.close()
Read-out process: the binary file my_pickle converted to read out the list
pickle_file = open('my_pickle.pkl','rb')
my_list = pickle.load(pickle_file)