Definition
The update() method inserts the specified items to the dictionary.
The specified items can be a dictionary, or an iterable object with key value pairs.
Syntax
dictionary.update(iter)
Parameters
Parameter | Description |
---|---|
iter | A dictionary or an iterable object with key value pairs, that will be inserted to the dictionary |
Examples:
person = {
"name": "Raymond",
"age": 29,
"country": "Japan"
}
person.update({"color": "brown"})
print(person)