English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
A Set is an unordered collection of items. Set items are unique and immutable. On this reference page, you will find all the methods that can be used with a set object.
Method | Description |
---|---|
add() | Add elements to the set. |
clear() | Remove all elements from the set. |
copy() | Return a copy of the set. |
difference() | Return a set containing the differences between two or more sets. |
difference_update() | Delete items that are also included in another specified set. |
discard() | Delete the specified item. |
intersection() | Return a set that is the intersection of two other sets. |
intersection_update() | Delete items that do not exist in other specified sets. |
isdisjoint() | Return whether two sets have an intersection. |
issubset() | Return whether another set contains this set. |
issuperset() | Return whether this set contains another set. |
pop() | Delete an element from the set. |
remove() | Delete the specified element. |
symmetric_difference() | Return a set containing the symmetric difference of two sets. |
symmetric_difference_update() | Insert the symmetric difference of this set and another set. |
union() | Return a set containing the union of sets. |
update() | Update the set with the union of this set and other sets. |
in our Python set tutorial Learn more about sets on this site.