import pickle data = { '🍅': 3, '🌭': 4, '🍔': 5 } with open('food.pickle', 'wb') as f: pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)