Removes values from nested dicts and lists
Project description
deep-filter
A simple package that filters out values from dicts/lists, including all dicts/lists nested within it.
Usage
from deep_filter import deep_filter
x = {
'nope': 69,
'yep': [
69,
{'maybe': None},
99
]
}
def filter_func:
return value != 69
result = deep_filter(x, filter_func)
print(result)
# {'yep': [{}, 99]}
deep_filter(dict_or_list, filter_func=default_filter_func)
- dict_or_list: A dictionary or list
- filter_func: An optional callback function. It will take a value as an argument, and return
True
if the value will be kept andFalse
if not. If omitted,None
values will be filtered out.
Returns your dict or list, filtered.
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
deep-filter-1.0.0.tar.gz
(1.6 kB
view hashes)
Built Distribution
Close
Hashes for deep_filter-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5ac20de9b16586b5bbb615895907e720b968b8f35ad432ed1d3b89ba5dca934 |
|
MD5 | 0749dd0f6d370979de67b329dfacacb2 |
|
BLAKE2b-256 | ebbe4d5a07c0cd25eb7258c9f27aece5935ad5e0b42a8ffb596c5277320b939e |