Returns None if a dict key does not exist
Project description
Python Optional
Returns None
if a dict key does not exist
Install
pip install python_optional
Usage
from python_optional import optional
data = {
'a' : 'b'
}
result = optional(data).get('a') # 'b'
result = optional(data).a # 'b'
result = optional(data).get('z') # None
result = optional(data).z # None
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_optional-1.1.0.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for python_optional-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef3d7d159f512964698a4aa8e5720427b87f6e5ba676cec593fb6e75f7d92fdc |
|
MD5 | 6ed9b0ed9b637e8f7d8ec340da802233 |
|
BLAKE2b-256 | 648a1fcf3540c018092e45e49f014fa566e9493cf8972f6d035b3d802d7e8bfb |