0
votes

Input:

dict1 = {a: [xxx, zzz]}
dict2 = {a: [yyy, zzz]}

Desired output:

dict3 = {a: [xxx, zzz, yyy, zzz]}

I have tried:

dict3 = dict1 | dict2

and

dict3 = dict1.copy()
d3 |= d2

However, the merge | and update |= operators overwrites with the last seen dict as precedence, resulting in:

dict3 = {a: [yyy, zzz]}