Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

update nested dictionary python

import collections.abc

def update(d, u):
    for k, v in u.items():
        if isinstance(v, collections.abc.Mapping):
            d[k] = update(d.get(k, {}), v)
        else:
            d[k] = v
    return d
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #update #nested #dictionary #python
ADD COMMENT
Topic
Name
4+9 =