Created
July 23, 2021 09:55
-
-
Save anujonthemove/67debf222fe79d7a27dc251479ede39d to your computer and use it in GitHub Desktop.
Save and read objects to and from pickle file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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