Skip to content

Instantly share code, notes, and snippets.

@LiamHz
Created October 8, 2018 14:52
Show Gist options
  • Save LiamHz/0e6ccee1eef61d1d25158a86a0de07d5 to your computer and use it in GitHub Desktop.
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
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