Python List clear() Method
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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.