Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python list clear() method is used to delete all elements of the specified list.

Syntax

list.clear()

Parameters

No parameter is required.

Return Value

None.

Example: Clear all elements of a list

In the below example, the list clear() method is used to delete all elements of the list called MyList.

MyList = [10, 50, 50, 100, 1000, 1000]

MyList.clear()      
print(MyList)

The output of the above code will be:

[]

❮ Python List Methods