Python List clear() Method

❮ List Methods


Example

Remove all elements from the fruits list:

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

fruits.clear()
Try it Yourself »

Definition and Usage

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


Syntax

list.clear()

Parameter Values

No parameters


❮ List Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.