Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

# merge two dictionaries

# merge two dictionaries
a = {'apple':1, 'melon': 4}
b = {'apple': 2, 'orange': 2,'banana':3}

merge_dic = {**a, **b}
print(merge_dic)                        # {'apple': 2, 'melon': 4, 'orange': 2, 'banana': 3}
#Python 3.9:
# a|b
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #merge #dictionaries
ADD COMMENT
Topic
Name
9+2 =