Even if there exists modules that do this (see other answer), I tried to write one simple, self-contained version. Here is a class KeyValueStore (key and value are strings) that works like this: Demo from sqlitekeyvaluestore import KeyValueStore kv = KeyValueStore('test.db') # uses SQLite print(len(kv)) # 0 item kv['hello1'] = 'you1' kv['hello2'] = 'you2' kv['hello3'] = 'you3' print(kv['hello1'])
{{#tags}}- {{label}}
{{/tags}}