spekk.trees.core.get#
- spekk.trees.core.get(tree: ~typing.Mapping[~typing.Any, ~typing.Mapping[~typing.Any, Tree] | ~typing.Sequence[Tree] | ~typing.Any] | ~typing.Sequence[~typing.Mapping[~typing.Any, Tree] | ~typing.Sequence[Tree] | ~typing.Any] | ~typing.Any, path: tuple, default: ~typing.Any = <object object>)[source]#
Get the subtree at the given path.
>>> tree = {"a": [1, {"b": 2}, 3], "c": 4} >>> get(tree, ("a", 1, "b")) 2