Skip to main content

Access dict values as attributes (works recursively)

USAGE

>>> from easydict import EasyDict as edict
>>> d = edict({'foo':3, 'bar':{'x':1, 'y':2}})
>>> d.foo
3
>>> d.bar.x
1

>>> d = edict(foo=3)
>>> d.foo
3

Very useful when exploiting parsed JSON content !

>>> from easydict import EasyDict
>>> from simplejson import loads
>>> j = """{
"Buffer": 12,
"List1": [
    {"type" : "point", "coordinates" : [100.1,54.9] },
    {"type" : "point", "coordinates" : [109.4,65.1] },
    {"type" : "point", "coordinates" : [115.2,80.2] },
    {"type" : "point", "coordinates" : [150.9,97.8] }
]
}"""
>>> d = EasyDict(loads(j))
>>> d.Buffer
12
>>> d.List1[0].coordinates[1]
54.9

LICENSE

  • Lesser GNU Public License

AUTHORS

Download files

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

Source Distribution

easydict-1.3.tar.gz (2.0 kB view details)

Uploaded Source

File details

Details for the file easydict-1.3.tar.gz.

File metadata

  • Download URL: easydict-1.3.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for easydict-1.3.tar.gz
Algorithm Hash digest
SHA256 bd63d4c7b2ecd624bb2eac976a68ebefeb2ef868762532472afa73eec3924713
MD5 1fe95400c5fb77ae4af24bff264338ce
BLAKE2b-256 c3b0ab419b102d882dded5231f59b349ea91c84fe797e901483d49f0357cffae

See more details on using hashes here.

Release history Release notifications | RSS feed

1.13

2 files

1.12

2 files

1.11

1 file

1.10

1 file

1.9

1 file

1.8

1 file

1.7

1 file

1.6

1 file

1.5

1 file

1.4

1 file

This release

1.3 This release

1 file

1.2

1 file

1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page