Skip to navigation
merge dict using update() with python3
11.01.22
Python3 # Python code to merge dict using update() method def Merge(dict1, dict2): return(dict2.update(dict1)) # Driver code dict1 = {'a': 10, 'b': 8} dict2 = {'d': 6, 'c': 4} # This return None print(Merge(dict1, dict2)) # changes made in dict2 print(dict2) Output: None {'c': 4, 'a': 10, 'b': 8, 'd': 6}
https://www.geeksforgeeks.org/python-merging-two-dictionaries/
Reply
Anonymous
Information Epoch 1732513444
Think parallel.
Home
Notebook
Contact us