Resolve dot notation from dictionary
Project description
pyresolve
![](https://pypi-camo.freetls.fastly.net/a072500bffc181f59854a30706551bb3fa06c2e2/68747470733a2f2f636972636c6563692e636f6d2f67682f6669766572722f70797265736f6c76652e7376673f7374796c653d737667)
Resolve dot notation from dictionary
from pyresolve import resolve
my_dictionary = {"out":{"middle":{"in":"Balue"}}}
# Before
my_dictionary.get('out', {}).get('middle', {}).get('in')
# After
resolve(my_dictionary, "out.middle.in") # "Balue"
Does not break for missing properties
resolve(my_dictionary, "outer.missing.something") # None
Can specify a different default value
resolve(my_dictionary, "outer.missing.something", []) # []
Supports index in list
dictionary_with_list = {"users": [{"name":"Joe"}, {"name":"Jane"}]}
resolve(my_dictionary, "users.1.name") # Jane
Install
pip install pyresolve
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyresolve-1.1.0.tar.gz
(1.8 kB
view hashes)
Built Distribution
Close
Hashes for pyresolve-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5567469ca99ad54b4075952e5e7dd21d9d8abf92bdf6e8c0d1407a9c2f0198d8 |
|
MD5 | 45e18a6a0f5bb7538da3110b1ba290b8 |
|
BLAKE2b-256 | 7be732bc295306194793bf0346118ff01a220140b8af47b5327721ef1cdf96cc |