Skip to main content

Removes values from nested dicts and lists

Project description


A simple package that filters out values from dicts/lists, including all dicts/lists nested within it.


from deep_filter import deep_filter
x = {
    'nope': 69,
    'yep': [
        {'maybe': None},
def filter_func:
    return value != 69
result = deep_filter(x, filter_func)
# {'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 and False if not. If omitted, None values will be filtered out.

Returns your dict or list, filtered.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for deep-filter, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size deep_filter-1.0.0-py2.py3-none-any.whl (2.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size deep-filter-1.0.0.tar.gz (1.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page