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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -