pyufunc.dict_set_by_path#

pyufunc.dict_set_by_path(mapping, key_path, value, *, separator='.')#

Set a nested dictionary value by key path.

Parameters:
  • mapping – Source mapping.

  • key_path – Key path to set.

  • value – Value to assign.

  • separator – Key path separator.

Note

Example

>>> dict_set_by_path({}, "a.b", 1)
{'a': {'b': 1}}
Returns:

Updated dictionary copy.

Return type:

dict[str, Any]