Python set methods
- Forrige Side Python Tuple Metoder
- Næste Side Python Filmetoder
Python has a set of built-in methods that can be used on sets.
Method | Description |
---|---|
add() | Add an element 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() | Remove items that are also included in another specified set. |
discard() | Remove the specified item. |
intersection() | Return a set that is the intersection of two other sets. |
intersection_update() | Remove 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() | Remove an element from the set. |
remove() | Remove the specified element. |
symmetric_difference() | Return a set containing the symmetric difference of two sets. |
symmetric_difference_update() | Indsæt symmetrisk forskel mellem dette sæt og et andet sæt. |
union() | Returnerer et sæt, der indeholder sætets union. |
update() | Opdater sættet med unionen af dette sæt og andre sæt. |
I vores Python Sæt Tutorial Lær mere om sæt i Kina.
- Forrige Side Python Tuple Metoder
- Næste Side Python Filmetoder