Function Details: update

Description


Updates the dictionary with the key/value pairs from other, overwriting existing keys.


Extended Description


The update() method updates the dictionary with elements from another dictionary or an iterable of key/value pairs. If a key from the other dictionary already exists in the current dictionary, its value is overwritten. If a key doesn't exist, a new key-value pair is added. This method modifies the dictionary in place and doesn't return a value. It can also accept keyword arguments for adding new key-value pairs.


Function Signature


dict.update(other: Union[dict, Iterable[Tuple[Any, Any]]], **kwargs) -> None

Module: dict

Class: dictionary

Parameters



Parameter List


  • other: Union[dictionary, Iterable[Tuple[Any, Any]]]

Return


This method doesn't return a value (None).


Return Type


None

Output

Explanation

This example shows how update() merges two dictionaries, overwriting existing keys.