Skip to main content

Dict class with dot notation (like attributes) for accessing nested values

Project description

Build Status Coverage Status


DotAccessDict class can handle nested dictionaries with arbitray number of dicts and lists, nested inside each other.


>>> from ddict import DotAccessDict
>>> d = DotAccessDict()
>>> d
>>> d.person
>>> = 'Jack'
>>> d
{'person': {'name': 'Jack'}}
>>> d['person']['name']
>>> d['person'].name
>>> d.person['name']
>>> joe = dict(name='Joe', age=18)
>>> d.person.brothers = [joe, 'John', 'Pat']
>>> d.person.brothers[0].age
>>> d.get('person.brothers[1]')
>>> d.set('person.brothers[2]', 'James')
>>> d.person.brothers[2]
>>> d.flatten()
{'person.brothers[0].age': 18,
 'person.brothers[0].name': 'Joe',
 'person.brothers[1]': 'John',
 'person.brothers[2]': 'James',
 '': 'Jack'}

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ddict, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size ddict-0.1.3.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page