z = {**x, **y}
dict1 = {'a': 10, 'b': 8} dict2 = {'d': 6, 'c': 4} dict2.update(dict1)
dict1 = {'color': 'blue', 'shape': 'square'} dict2 = {'color': 'red', 'edges': 4} dict1.update(dict2) #if a key exists in both, it takes the value of the second dict # dict1 = {'color': 'red', 'shape': 'square', 'edges': 4} # dict2 is left unchanged
>>> x = {'a': 1, 'b': 2} >>> y = {'b': 10, 'c': 11} >>> z = {**x, **y} #In Python 3.5 or greater only >>> print(z) {'a': 1, 'b': 10, 'c': 11}
dic0.update(dic1)