dict.update()
dict.update() is a Python method in the Dictionary Methods category. Updates the dictionary with key-value pairs from another dict or keyword args. The syntax is dict.update(other_dict=None, **kwargs). Parameters: other_dict — mapping or iterable. Returns: None. A typical example: d = {"a": 1}
d.update({"b": 2}) # d = {"a": 1, "b": 2}
d.update(c=3) # d = {"a": 1, "b": 2, "c": 3}. A close sibling is dict.get(), which returns the value for key if it exists, otherwise returns default. A close sibling is dict.keys(), which returns a view object of all keys in the dictionary. A close sibling is dict.values(), which returns a view object of all values in the dictionary. A close sibling is dict.items(), which returns a view object of all (key, value) pairs as tuples. More about this category: Dictionary methods for key-value operations — get, keys, items, update, and more. For a broader walkthrough, read the Dictionary Methods guide.