How to Remove all items from the List in Python?

Last updated on February 1, 2023 by Ayaz Ali Shah

To remove all the items from the list you can use the clear() method in python. It doesn’t accept any parameter because it removes all the items.

Let’s create a list of devices and store them into a variable.

devices = ["laptop", "phone", "watch"]

In this variable we have stored the list that has few items. To remove all the items we can attach a clear() method with devices variable which will remove the items.


Now to check the items inside the list we can print it.

# Output: []

In the response we got an empty list which means clear() method successfully removed all the items.

Share on:

Related Posts

Tags: Python,

Recent Posts