The update method
The update method supplements the original dictionary with keys and values of another dictionary. In the method parameter, we specify the dictionary with which we will supplement the original one.
Syntax
dictionary.update(dictionary to supplement the original)
Example
Let's update our dictionary using the update method:
dct1 = {
'a': 1,
'b': 2,
'c': 3
}
dct2 = {
'e': 4,
'f': 5
}
dct1.update(dct2)
print(dct1)
Result of code execution:
{'a': 1, 'b': 2, 'c': 3, 'e': 4, 'f': 5}