How to Remove all items from the List in Python?

Last updated on February 1, 2023

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.

Written by
I am a skilled full-stack developer with extensive experience in creating and deploying large and small-scale applications. My expertise spans front-end and back-end technologies, along with database management and server-side programming.

Share on:

Related Posts

Tags: Python,