Created
October 8, 2018 14:52
-
-
Save LiamHz/0e6ccee1eef61d1d25158a86a0de07d5 to your computer and use it in GitHub Desktop.
A demo of how to use Pickle to read and write to disk
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
import pickle | |
data = {} | |
# Read from disk | |
pickle_jar = open('data.pkl', 'rb') | |
data = pickle.load(pickle_jar) | |
# Write to disk | |
pickle_jar = open('data.pkl', 'wb') | |
pickle.dump(data, pickle_jar) | |
pickle_jar.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment