Remove List Items

3 min read ·

Removing items from a list is a common operation in Python. Because lists are mutable, Python provides multiple ways to remove elements by value, by index, or completely.
This topic covers all correct ways to remove list items, including edge cases and best practices.

Remove Item Using remove()

The remove() method removes the first occurrence of a specified value.

Important Note

If the value does not exist, Python raises an error.

Remove Item Using pop()

The pop() method removes an item by index and returns it.

Remove Last Item


Remove Item at Specific Index


Remove Item Using del

The del keyword removes an item by index or deletes the entire list.

Delete Item at Index


Delete a Slice


Delete Entire List


Remove All Items Using clear()

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

Remove Items Using a Loop

Remove All Occurrences of a Value


Remove Using List Comprehension


Remove Items Conditionally


Common Mistakes

Modifying List While Iterating

This produces unexpected results.

Safe Way to Remove While Iterating


Difference Between remove(), pop(), and del

MethodRemoves byReturns valueRaises error
remove()ValueNoIf value not found
pop()IndexYesIf index invalid
delIndex / SliceNoIf index invalid
clear()All itemsNoNo

Learn Python Remove List Items | Python Course