How to merge dictionaries of dictionaries?

I need to merge multiple dictionaries, here’s what I have for instance: dict1 = {1:{“a”:{A}}, 2:{“b”:{B}}} dict2 = {2:{“c”:{C}}, 3:{“d”:{D}} With A B C and D being leaves of the tree, like {“info1″:”value”, “info2″:”value2”} There is an unknown level(depth) of dictionaries, it could be {2:{“c”:{“z”:{“y”:{C}}}}} In my case it represents a directory/files structure with nodes … Read more