Dictionaries
nested_dict_delete(root, key, sep='.')
Iterate through a dict, deleting items recursively based on a key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
root |
dict |
dictionary to remove an entry from |
required |
key |
str |
the string used to locate the key to delete in the root dictionary |
required |
sep |
str |
the separator for dictionary key items |
'.' |
Returns:
Type | Description |
---|---|
dict |
the modified dict_to |
Examples:
1 2 3 4 5 6 7 8 |
|
Source code in chmpy/util/dict.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
recursive_dict_update(dict_to, dict_from)
Iterate through a dictionary , updating items inplace recursively from a second dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dict_to |
dict |
the first dictionary (to update) |
required |
dict_from |
dict |
the second dictionary (to pull updates from) |
required |
Returns:
Type | Description |
---|---|
dict |
the modified dict_to |
Examples:
1 2 3 4 |
|
Source code in chmpy/util/dict.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|