inner_all_keys

inner_all_keys(data: dict, keys: list = None, lvl: int = 0)[source][source]

Get all keys of a nested dictionary.

Parameters:
  • data (dict) – The nested dictionary to get the keys of.

  • keys (list, optional) – The list of keys, by default None

  • lvl (int, optional) – The level of the dictionary, by default 0

Returns:

The tuple of keys.

Return type:

tuple

Examples

>>> data = {'a': {'b': {'c': 1}}}
>>> inner_all_keys(data)
(('a',), ('b',), ('c',))
>>> data = {'a': {'b': {'c': 1}}, 'd': {'b': {'c': 2, 'e': 3}}}
>>> inner_all_keys(data)
(('a', 'd'), ('b',), ('c', 'e'))