Created
November 13, 2017 14:07
-
-
Save osin-vladimir/eb3d3e85d605924e3e5f0e47ca12758b to your computer and use it in GitHub Desktop.
save/load objects in python
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
# save/load objects in python | |
import pickle | |
def save_obj(obj, name ): | |
with open('obj/'+ name + '.pkl', 'wb') as f: | |
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL) | |
def load_obj(name ): | |
with open('obj/' + name + '.pkl', 'rb') as f: | |
return pickle.load(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment