LoginSignup
0
0

More than 3 years have passed since last update.

Python pickle の使い方サンプル

Posted at

import pickle

sample_dic = {'key1': 1, 'key2': 2, 'key3': 3}
sample_dic['key4'] = 4
f = open('sample.binaryfile','wb')
pickle.dump(sample_dic,f)
f.close


f = open('sample.binaryfile','rb')

new_dic = pickle.load(f)

print(new_dic)
print(new_dic['key4'])
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0