Created
November 4, 2014 06:52
-
-
Save vishvendra01/de5f8891e1b42f3e8a4f to your computer and use it in GitHub Desktop.
python pickle working example
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 | |
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