pickle read file code example
Example 1: read pickle file
with open('filename', 'rb') as f:
x = pickle.load(f)
Example 2: pickle save
import pickle
pickle.dump( favorite_color, open( "save.p", "wb" ) )
favorite_color = pickle.load( open( "save.p", "rb" ) )
Example 3: pickle.load python
import pickle
data = pickle.load(open(file_path, "rb"))
data = pickle.load(var)
Example 4: read pickle file
with open('filename', 'a') as f:
pickle.dump(data, f)
Example 5: save a file as a pickle
with open('mypickle.pickle', 'wb') as f:
pickle.dump(some_obj, f)