DictDefaultNone
Get data from nested lists and dictionaries use Simple syntax, if can‘t return None, no raise IndexError or KeyError 用简单的python语法快速获取嵌套列表或者字典里的数据,如果没取到则返回空,而不是抛出IndexError或者KeyError
eg.: dict1["k1"]["k2"][0]["k"]
from ddn import DDN
data = {
"data": [
{
"key1": "123",
"key2": {
"kkey1": {
"kkkey1": "1234",
"kkkey2": 12345
}
}
},
{
"key1": "'1234'",
"key3": {
"kkey1": {
"kkkey1": "1234",
"kkkey2": True
}
}
}
]
}
d = DDN(data)
if res1 := d['data'][1]["key3"]["kkey1"]['kkkey1']: # '1234'
print('ok', res1)
if not (res2 := d['data'][88]["user"]["username"]['firstname']): # ''
print('no', res2 + '1234')
print(DDN({13: 1}) + {23: 4}) # {13: 1, 23: 4}
print(DDN({13: 1}) + '123123', type(DDN({13: 1}) + '123123')) # {13: 1}123123 <class 'str'>
Metadata
Release files for ddn 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ddn-1.0.1.tar.gz | 15.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ddn-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / ddn-1.0.1.tar.gz
| Download URL | ddn-1.0.1.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f76720945c5fb160b1a72609c73f041995c0c9949779ae7b29591c3c00ea9375
|
|
BLAKE2b-256 checksum How to use checksums |
77fa56e7082d649f2bb627bb72c6ec7f51a55cb441f537a4cfce031d0b279e81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / ddn-1.0.1-py3-none-any.whl
| Download URL | ddn-1.0.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef7f8f8b02ab3cd217a95ca7e93d0520724bf525ab3d7af742d3e9112658a0ea
|
|
BLAKE2b-256 checksum How to use checksums |
09423fbe54ab386c0dbec24752898f7f8d05ef4255c715a661c1296dab26d387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for ddn 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.