Say there are two dicts, and some of key them are dulpicated. Then I want to combine these two dict, and use the key of d2 to replace d1.
d1 = {
"2222": {1:3},
"3333":{1:5}
}
d2 = {
"2222": {1:5},
"4444":"a"
}
# expected output is
# {'2222': {1: 5}, '3333': {1: 5}, '4444': 'a'}
I tried with
d3 = {**d1, **d2} # works
d4 = dict(**d1, **d2) # failed
TypeError: type object got multiple values for keyword argument '2222'
I'm confused why d3 = {**d1, **d2}worked but d4 = dict(**d1, **d2) failed and what the ** means in these two expression?