Skip to content

Kozichuk/python_persist_dict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persisted Dictionary

PyPi Version

Dictionary implementation with saving values into files. Based on shelve lib.

Supported operations

  • get value by key
  • set value by key
    • if key exists - rewrite value
  • delete value by key
  • clear dictionary

Install

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

Examples

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]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages