Let's say we have these two dictionaries:
a = {"A": "MyText", "B": {"Sub": "Hello", "NextSub": "Bye"}}
b = {"B": {"NextSub": 55}}
How to merge them together so that I get this result (such that it will work with every type of dictionary)?
ab = {"A": "MyText", "B": {"Sub": "Hello", "NextSub": 55}}
a.update(b)
just replaces "B".
I want to merge some dicts because I need to handle with them all. So it's faster if I handle with one merged dict which contains the latest information of all dicts instead of handling with more dicts in a for-loop which would be slower.
Thank you!