set_nested_dict¶
- set_nested_dict(dct: dict, keys: tuple[Any], value: Any) None[source]¶
Set a hierarchy of dictionaries with given keys and value for the lowest level key.
>>> d = {} >>> set_nested_dict(d, ('key1', 'key2', 'key3'), 1) >>> print(d) {'key1': {'key2': {'key3': 1}}}
- Parameters:
dct -- Any dictionary
keys -- List of keys to build hierarchy
value -- Value for lowest level key
- Returns:
None. The dictionary is modified in place.