import pickle a = {'hi': 'everybody'} with open('filename.pickle', 'wb') as f: pickle.dump(a, f, protocol=pickle.HIGHEST_PROTOCOL) with open('filename.pickle', 'rb') as f: b = pickle.load(f)