what is pickle file python code example
Example 1: read pickle file
with open('filename', 'rb') as f:
x = pickle.load(f)
Example 2: pickle load
with open('filename', 'rb') as f:
x = pickle.load(f)
Example 3: write data to using pickle
import pickle
example_dict = {1:"6",2:"2",3:"f"}
pickle_out = open("dict.pickle","wb")
pickle.dump(example_dict, pickle_out)
pickle_out.close()
Example 4: read pickle file
with open('filename', 'a') as f:
pickle.dump(data, f)