Python List clear() Method

Removes all items from the list.

Syntax

Python
list.clear()

Example

Python
groceries = ['apples', 'oranges', 'paper towels']
groceries.clear()
print(groceries)

Output

[]