Skip to content

Instantly share code, notes, and snippets.

@vishvendra01
Created November 4, 2014 06:52
Show Gist options
  • Save vishvendra01/de5f8891e1b42f3e8a4f to your computer and use it in GitHub Desktop.
Save vishvendra01/de5f8891e1b42f3e8a4f to your computer and use it in GitHub Desktop.
python pickle working example
import pickle
favorite_color = {"lion":"yellow", "kitty":"red"}
pickle.dump(favorite_color, open("save.p", "wb"))
favorite_color = pickle.load( open("save.p", "rb"))
# in python, you can speed up pickle access with cPickle
# in python 3, importing pickle will automatically use the
# accelerated version if available
# in python 2
import cPickle as pickle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment