Storing Python dictionaries
Pickle save: try: import cPickle as pickle except ImportError: # Python 3.x import pickle with open(‘data.p’, ‘wb’) as fp: pickle.dump(data, fp, protocol=pickle.HIGHEST_PROTOCOL) See the pickle module documentation for additional information regarding the protocol argument. Pickle load: with open(‘data.p’, ‘rb’) as fp: data = pickle.load(fp) JSON save: import json with open(‘data.json’, ‘w’) as fp: json.dump(data, fp) … Read more