Is there any generic way to update python dictionary without overwriting the sub-dicts. The dictionaries are dynamically generated hence, cannot predict the level, depth or subkeys in advance.
Consider following two dictionaries are generated dynamically -
d1 = {'a' : { 'b' : 'c'} }
d2 = {'a' : { 'd' : 'e'} }
If I call an update function the result would be something like this d1.update(d2) print d1
Result =
{'a': {'d': 'e'}}
Expected Result =
{'a': {'b': 'c', 'd': 'e'}}
Above dictionaries are just for an example. The dictionaries could be of any level dynamically generated. Hence, provide if any in built function for python.. or some other way.