Python Dictionary update

The Python update method is useful for updating key-value pairs of a dictionary. It is instrumental in updating one dictionary value with another or inserting key-value pairs from user inputs. In this section, we discuss how to use it, and the syntax is:


Python Dictionary update Example

This method updates the dictionary object with another one.

TIP: Refer to the Dictionary in this language.

myDict = {1: 'apple', 2: 'Banana'}
myNewDict = {3: 'Orange', 4: 'Kiwi'}
print("Items: ", myDict)
print("New Items: ", myNewDict)

print("\nItems  :  ",  myDict)
Python Dictionary update function Example