Answers for "merge dict based on key"

0

merge multile dict

dict1 = {"a":1, "b":2}
dict2 = {"x":3, "y":4}
merged = {**dict1, **dict2}
print(merged) # {'a': 1, 'b': 2, 'x': 3, 'y': 4}
Posted by: Guest on August-20-2020
-2

concat dicts python

d1={1:2,3:4}; d2={5:6,7:9}; d3={10:8,13:22}
d4 = dict(d1, **d2); d4.update(d3)
Posted by: Guest on July-10-2020

Code answers related to "merge dict based on key"

Python Answers by Framework

Browse Popular Code Answers by Language