Answers for "how to combine dictionaries in python"

0

python merge two dictionaries

d1 = {'name': 'Alex', 'age': 25}
d2 = {'name': 'Alex', 'city': 'New York'}
merged_dict = {**d1, **d2}
print(merged_dict) # {'name': 'Alex', 'age': 25, 'city': 'New York'}
Posted by: Guest on October-20-2021

Code answers related to "how to combine dictionaries in python"

Python Answers by Framework

Browse Popular Code Answers by Language