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
Post a Comment