Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vkuznet/dotdict
Python dictionary extension via dot notations
https://github.com/vkuznet/dotdict
Last synced: 3 months ago
JSON representation
Python dictionary extension via dot notations
- Host: GitHub
- URL: https://github.com/vkuznet/dotdict
- Owner: vkuznet
- Created: 2011-08-05T15:58:42.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-04-08T12:59:58.000Z (almost 13 years ago)
- Last Synced: 2024-10-04T15:42:45.853Z (3 months ago)
- Language: Python
- Homepage:
- Size: 109 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
Description:
------------DotDict is an extension of python dictionary which uses and operates
with dot notations. For example, DotDict.get('a.b.c') or simply
DotDict['a.b.c']. It extends set/get operations to set/assign new
values, as well as provide get_keys/get_values/delete APIs. It also
smart enough to work with complex dict structures. Here is a few
examples:from ddict import DotDict
row = {'a':{'b':1, 'c':[1,2]}}
rec = DotDict(row)
print rec['a.c']
[1,2]
rec['x.y.z'] = 1
print rec
{'a':{'b':1, 'c':[1,2]}, 'x': {'y': {'z': 1}}For a complete list of examples, see ddict_t.py unit test module.