Merging Dictionaries in Python


Merge two dictionaries into a new dictionary.

Source Code

dict1 = {"a": 1, "b": 2}
dict2 = {"b": 3, "c": 4}
merged = {**dict1, **dict2}
print(merged)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments