Answers for "how to import pickle"

2

python pickle example

import pickle
favorite_color = { "lion": "yellow", "kitty": "red" }
with open( "save.p", "wb" ) as f:
	pickle.dump( favorite_color, f)
with open( "save.p", "rb" ) as f:
	favorite_color = pickle.load(f)
Posted by: Guest on September-21-2021
3

pickle load pickle file

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

Python Answers by Framework

Browse Popular Code Answers by Language