Awesome module for conver dict to class
Project description
About this project:
- This project created to convert any dict into class in python :) check github
Install:
pip install python-dtoc
Simple example:
- Print the object :
from pydtoc import dtc
foo = dtc({'str': 'string', 'int': 1, 'list': [1, 2, 3, 4, {'hi': True}]})
print(foo)
- Output :
{
"str": "string",
"int": 1,
"list": [
1,
2,
3,
4,
{
"hi": true
}
]
}
- Print key of value :
from pydtoc import dtc
foo = dtc({'str': 'string', 'int': 1, 'list': [1, 2, 3, 4, {'hi': True}]})
print(foo.list[-1].hi)
print(foo.str)
- Output :
True
string
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
python-dtoc-2023.10.5.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for python_dtoc-2023.10.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a5334ce0d16cc43f4d5e0419b9b22a5226a632884378f87f7d0118057adc287 |
|
MD5 | c2da993bdfa6c7fbfd5743ea8b35d81a |
|
BLAKE2b-256 | e22a5fb867fbe868e5d58f00d916554011a9a4043b37ff87bc291b55d3309511 |