Dictionary implementation with saving values into files. Based on shelve lib.
- get value by key
- set value by key
- if key exists - rewrite value
- delete value by key
- clear dictionary
Using pip
pip install -i https://test.pypi.org/simple/ persistent-dictionary
Using setup.py
# clone repo
# cd into repo dir
python setup.py install
from persistent_dict.persistent_dict import PersistentDict
path_to_storage = 'persistent_storage'
test_dict = PersistentDict(path_to_storage)
# created dir with storages
# set operations
test_dict[123] = 123
test_dict['123'] = 321
# get operations
print(test_dict[123])
# 123
print(test_dict['123'])
# 321
# get all keys
print (test_dict.keys())
# [123, '123']
# delete by key
del test_dict[123]