Skip to main content

system.kanoa.utilities.getDictionaryValue

Description

Recursively searches for a key in a nested dictionary.

Syntax

getDictionaryValue(data, key)
  • Parameters
      data (dict): The dictionary to search.
      key (str): The key to find.
  • Returns
      The value associated with the key if found, otherwise None.
  • Code Examples

    # Example Usage:
    data = {
    'dict1': {
    'key1': 4,
    'key2': 9,
    'key3': 14
    },
    'key4': 19
    }
    val = system.kanoa.utilities.getDictionaryValue(data, 'key3')
    >>>
    14
    >>>