A userful package to use '.' to visit value of dict
Project description
dict_wrapper
user DictWrapper to visit the value like an object
Installing
Install and update using pip
:
pip install -U dict_wrapper
A Simple Example
.. code-block:: python
from dict_wrapper import DictWrapper
data = {
"who": 'your name',
"area": ['specify', 'china'],
"province": {
"city": ['shenzhen', 'guangzhou']
},
"citys":[{
"name":"shenzhen",
"othername":"鹏城"
}]
}
config, config1 = DW(data), DictWrapper(data)
assert config.who == 'your name'
assert config.province.city == ['shenzhen', 'guangzhou']
print(config.area)
print(config1.citys[0].name)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dict_wrapper-0.0.4.tar.gz
(6.1 kB
view hashes)
Built Distributions
dict_wrapper-0.0.4-py3.8.egg
(3.5 kB
view hashes)
Close
Hashes for dict_wrapper-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 754e09db72c890f9c3f6293011281a5d56ceaa415f7c67f5a538875591b8e4c5 |
|
MD5 | d4265d00bf162c6c1b6e634a2bc082d2 |
|
BLAKE2b-256 | a7e52a8a9eef7e33278dddc26be7efbfee37e027cf64a934642e69fa1762945d |