I have two nested dictionary which might contain the same key but with different value (i.e. different inner-dictionary but with same key outside)
for instance:
dict_a = {"2": {"2": 0, "12": "94960", "25": "61026"}, "229": {"101": "29043", "106": "25298", "110": "48283", "112": "16219", "126": "35669", "147": "37675"}}
dict_b = {{"1": {"1": 0, "2": "84543", "3": "34854", "5": "123439}, "229": {"2": "71355", "12": "24751", "25": "33600", "229": 0}}
here the key "229" exists in both outer dictionaries, but associating with different value (different inner dictionaries)
I firstly get dict_a, and later I get dict_b. Then I want to update dict_a with all key and values added from dict_b. i.e.
dict_a_updated = {"2": {"2": 0, "12": "94960", "25": "61026"}, "229": {"101": "29043", "106": "25298", "110": "48283", "112": "16219", "126": "35669", "147": "37675", "2": "71355", "12": "24751", "25": "33600", "229": 0}}}
{{"1": {"1": 0, "2": "84543", "3": "34854", "5": "123439}}
I haved tried .update method:
dict_a_updated = dict_a.update(dict_b)
the result is that the key "229" and its value from dict_b will overwrite the ones in dict_a. Overwriting is not wanted since I want to keep adding new values for the exisiting keys. what is the right way to do this?