Created
October 27, 2017 06:16
-
-
Save vunb/e1a5e09f976bd2d781aec8b538ad3d88 to your computer and use it in GitHub Desktop.
Convert python pickle format to json
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 sys | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
try: | |
import cPickle as pickle | |
except ImportError: | |
import pickle | |
with open("dictionary.pickle", "rb") as f: | |
with open('dictionary.json', 'w') as outfile: | |
json.dump(pickle.load(f), outfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment