import pickle my_dict = { 'balls': 4, 'halles': 2, 'mango': 6, 'Grapes': 11} with open("myDictionary.pkl", "wb") as tf: pickle.dump(my_dict,tf)