配列とかのオブジェクトをファイルに書き出して保存しておける
標準機能
import pickle
profile = {'name': 'shena', 'age': 17, 'favs': ['frog', 'moss']}
データをファイルとして保存
with open('pickled.pkl', 'wb') as f:
pickle.dump(profile, f)
wb
= 書き込み(バイナリ)
ファイルから読み込み
with open('pickled.pkl', 'rb') as f:
load_profile = pickle.load(f)
print(load_profile)
{'name': 'shena', 'age': 17, 'favs': ['frog', 'moss']}
rb
= 読み込み(バイナリ)