Python Set clear() Method

Removes all the items from the set, returning an empty set.

Syntax

Python
set.clear()

Example

Python
components = {'memory', 'processor', 'SSD'}
components.clear()
print(components)

Output

set()