key_exists

Contents

key_exists#

eoio.utils.dict_tools.key_exists(test_dict: dict, keys: str | list, include: str = 'any')[source]#

Determine whether a key (or multiple keys) are present in a nested iterable.

Default (‘any’ input) return True if any of the listed keys are in the iterable, else False. If ‘all’ input selected for ‘include’, return True if all listed keys are in iterable, else False.

Parameters:
  • test_dict – iterable through which to search

  • keys – keys to search for in iterable

  • include – whether to search for ‘all’ keys or ‘any’ keys

Returns:

True when the requested key or keys are present, otherwise False.