Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

change value in nested dictionary python

import collections

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