THE WORLD'S LARGEST WEB DEVELOPER SITE

Python List clear() Method

❮ List Methods


Example

Remove all elements from the fruits list:

fruits = ['apple', 'banana', 'cherry', 'orange']

fruits.clear()
Run example »

Definition and Usage

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


Syntax

list.clear()

Parameter Values

No parameters


❮ List Methods