0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dbm

Last updated at Posted at 2020-03-07

#書き込めるのは、バイトか文字列のみ

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'
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?