python - Dictionary Python3. Updating value of dict -



python - Dictionary Python3. Updating value of dict -

need help thought how update dictionary value represented dictinary.

here 2 dictionaries: d1 = {'x': {'y': 5}} d2 = {'x': {'z': 6}}

assume d1 + d2, dictionary = {'x': {'y': 5, 'z': 6}}

thank you.

it's rather simple...

d1['x'].update(d2['x'])

or keys:

[d1[k].update(d2[k]) k in d1]

python dictionary

Comments

Popular posts from this blog

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -