Python List clear() Method

Example

Remove all elements from the fruits list:

fruits = ['apple', 'banana', 'cherry', 'orange']
fruits.clear()

Running instance

Definition and usage

The clear() method removes all elements from the list.

Syntax

list.clear()

Parameter value

No parameters.