A python package for accessing internal keys of a dictionary easily. RoDict internally stores the data as a dictionary.
Any internal keys of a dictionary by using a key by separating the nested keys using a separator. Default separator is __
(two underscores).
For example consider the following dictionary:
data = {
'a' : {
'b': {
'c': 10
}
}
}
Accessing value of key 'c' in the above dictionary:
>>> data = data['a']
>>> data = data['b']
>>> data = data['c']
>>> print data
>>> from rodict import RoDict
>>> r = RoDict(store=data)
>>> print r['a__b__c']
Not only for getting values, setting values for a key in dict can be done using the same syntax.
Right now I'm using this package for maintaining/updating configuration files in json
where values need to be dynamically updating during runtime.
For contribution:
$ git clone [email protected]:Prashant-Surya/rodict.git
$ cd rodict
$ python setup.py develop
Just for using it as a package:
$ git clone [email protected]:Prashant-Surya/rodict.git
$ cd rodict
$ python setup.py install
- For contributing to the RoDict create a fork from this repo.
- Work on a feature branch.
- Raise a Pull Request to the master branch of this repo.