Skip to content

Instantly share code, notes, and snippets.

@anujonthemove
Created July 23, 2021 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anujonthemove/67debf222fe79d7a27dc251479ede39d to your computer and use it in GitHub Desktop.
Save anujonthemove/67debf222fe79d7a27dc251479ede39d to your computer and use it in GitHub Desktop.
Save and read objects to and from pickle file
def save_pickle(pkl_object, name):
with open(name, 'wb') as handle:
pickle.dump(pkl_object, handle, protocol=pickle.HIGHEST_PROTOCOL)
def read_pickle(pickle_file):
b = None
with open(pickle_file, 'rb') as handle:
b = pickle.load(handle)
return b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment