mapping_get
No overview available.
def mapping_get(
data: Union[dict, list],
keys: Iterable,
default: any = None
) - > any
Retrieves a value from a nested dictionary or list structure using a sequence of keys. This function allows for safe traversal of complex data structures by returning a default value if any key in the path is missing.
Parameters
| Name | Type | Description |
|---|---|---|
| data | Union[dict, list] | The root mapping or sequence object to be traversed. |
| keys | Iterable | A sequence of keys or indices representing the path to the desired value. |
| default | any = None | The value to return if a key is not found or an index is out of range during traversal. |
Returns
| Type | Description |
|---|---|
any | The value found at the end of the key path, or the provided default value if the path is unreachable. |