Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to store object in file python

import pickle

myobj = MyObj()

# save obj to file
with open('myfile.pkl', 'wb') as f:
	pickle.dump(myobj, f)

# read obj from file
with open('myfile.pkl', 'wb') as f:
	obj = pickle.load(f)
 
PREVIOUS NEXT
Tagged: #store #object #file #python
ADD COMMENT
Topic
Name
6+9 =