|
・In Japanese
■Description
You can save (pickle) and load objects in multiple formats at once.
■Example
<Save Data:dump>
import pickle
a = ['dog', 10, {'cat':5}]
with open('test', 'wb') as file: # 'wb' means open binary file in overwrite mode
pickle.dump(a , file)
<Load Data:load>
with open('test', 'rb') as file: # 'rb' means to open the binary file in read-only mode
b = pickle.load(file)
print(b)
⇒ ['dog', 10, {'cat': 5}]
|
|