afile = open('C:\\d.pkl', 'wb')
pickle.dump(d, afile)
afile.close()
file2 = open('C:\\d.pkl', 'rb')
new_d = pickle.load(file2)
file2.close()
print(new_d)
Easiest way to persist a data structure to a file in python?