Python Set clear() Method
Example
Remove all elements from the fruits
set:
fruits =
{"apple", "banana", "cherry"}
fruits.clear()
print(fruits)
Try it Yourself »
Definition and Usage
The clear()
method removes all elements in a
set.
Syntax
set.clear()
Parameter Values
No parameters