Python Set update() Method
Example
Insert the items from set y into set x:
x = {"apple", "banana", "cherry"} y = {"google", "microsoft", "apple"} x.update(y) print(x)
Definition and Usage
The update() method updates the current set by adding items from another set.
If an item exists in both sets, the item will appear only once in the updated set.
Syntax
set.update(set)
Parameter Value
Parameter | Description |
---|---|
set | Required. Insert the set into the current set. |