I am trying to join dictionaries in this way:
d1 = {1: [1, 2, 3], 2: [5, 4, 35]}
d2 = {1: [4, 5, 6], 2: [32, 54, 102]}
d3 = {3: [943, 23, 111, 3], 1: [7, 8, 9]}
dictionary_result = {1: [1, 2, 3, 4, 5, 6, 7, 8, 9], 2: [5, 4, 35, 32, 54, 102], 3: [943, 23, 111,3]}
I tried this, but only works for 2 dictionaries
from collections import defaultdict
a, b = {1: [2, 3], 2: [3]}, {1: [4], 3: [1]}
de = defaultdict(list, a)
for i, j in b.items():
de[i].extend(j)
So, how can I join N dictionaries like this efficiently?