#書き込めるのは、バイトか文字列のみ
import dbm
#r:読み込み専用、w:書き込み専用、c:読み書き両方
with dbm.open('cache','c') as db:
db['key1']='values1'
db['key2'] = 'values2'
#db['key3']=1
with dbm.open('cache','r') as db:
print(db.get('key1'))
出力:
b'values3'
Go to list of users who liked
More than 3 years have passed since last update.
#書き込めるのは、バイトか文字列のみ
import dbm
#r:読み込み専用、w:書き込み専用、c:読み書き両方
with dbm.open('cache','c') as db:
db['key1']='values1'
db['key2'] = 'values2'
#db['key3']=1
with dbm.open('cache','r') as db:
print(db.get('key1'))
出力:
b'values3'
Register as a new user and use Qiita more conveniently
Go to list of users who liked