Answers for "what is a pickle file?"

3

pickle load pickle file

pickle_in = open("dict.pickle","rb")
example_dict = pickle.load(pickle_in)
Posted by: Guest on May-27-2020
0

Pickle example

import pickle

a = {'hello': 'world'}

with open('filename.pickle', 'wb') as handle:
    pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pickle', 'rb') as handle:
    b = pickle.load(handle)

print a == b
Posted by: Guest on October-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language