Syntax of Python Dictionary Update Method

The dictionary update() method in Python has the following syntax:

Syntax: dict.update([other])

Parameters: This method takes either a dictionary or an iterable object of key/value pairs (generally tuples) as parameters.

Returns: It doesn’t return any value but updates the Dictionary with elements from a dictionary object or an iterable object of key/value pairs.

Python Dictionary update() method

Python Dictionary update() method updates the dictionary with the elements from another dictionary object or from an iterable of key/value pairs.

Example:

Original dictionary : {'A': 'Geeks', 'B': 'For'}
Updated dictionary : {'A': 'Geeks', 'B': 'Geeks'}

Original dictionary : {'A': 'Geeks', 'B': 'For'}
Updated dictionary : {'A': 'Geeks', 'B': 'For', 'C': 'Geeks'}

Similar Reads

Syntax of Python Dictionary Update Method

The dictionary update() method in Python has the following syntax:...

Python Dictionary update() Example

Let us see a few examples of the update() method to update the data of the Python dictionary....