Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

save and load a dictionary python

import pickle
dictionary_data = {"a": 1, "b": 2}
a_file = open("data.pkl", "wb")
pickle.dump(dictionary_data, a_file)
a_file.close()
a_file = open("data.pkl", "rb")
output = pickle.load(a_file)
print(output)
a_file.close()
 
PREVIOUS NEXT
Tagged: #save #load #dictionary #python
ADD COMMENT
Topic
Name
5+7 =