1import pickle
2dictionary_data = {"a": 1, "b": 2}
3
4# SAVE
5with open("data.pkl", "wb") as pkl_handle:
6 pickle.dump(dictionary_data, pkl_handle)
7
8# LOAD
9with open("data.pkl", "rb") as pkl_handle:
10 output = pickle.load(pkl_handle)
11
12print(output)
1dict = {'Python' : '.py', 'C++' : '.cpp', 'Java' : '.java'}
2f = open("dict.txt","w")
3f.write( str(dict) )
4f.close()