Last modified: Aug 12, 2026

Python Remove Item from List: Methods & Examples

Removing items from a list is a common task in Python. You might need to delete a specific value, remove an element by its index, or clear the entire list. Python offers several built-in methods to handle this efficiently.

In this guide, you will learn the main ways to remove items. We will cover remove(), pop(), del, and list comprehensions. Each method has its own use case, so choosing the right one depends on what you know about the item you want to delete.

Let's dive into practical examples. We'll keep the code simple and show the output right away. This will help you understand the behavior of each method quickly.

Using the remove() Method

The remove() method deletes the first occurrence of a specified value. It does not return the removed item. Instead, it modifies the list in place. If the value is not found, Python raises a ValueError.

This method is perfect when you know the value you want to delete but not its index. It searches the list from the beginning and removes the first match.


# Create a list of fruits
fruits = ['apple', 'banana', 'cherry', 'banana']

# Remove the first 'banana'
fruits.remove('banana')

print(fruits)

Output:


['apple', 'cherry', 'banana']

Notice that only the first 'banana' is removed. The second one remains. If you try to remove a value that doesn't exist, you'll get an error. Always check if the value exists before using remove() to avoid crashes.

Using the pop() Method

The pop() method removes an item at a given index and returns it. If you do not specify an index, it removes and returns the last item. This is useful when you need the removed value for further processing.

This method is ideal when you know the position of the item. It also helps you implement a stack data structure, where you add and remove from the end.


# Create a list of numbers
numbers = [10, 20, 30, 40]

# Remove the item at index 2 (value 30)
removed_item = numbers.pop(2)

print(numbers)
print('Removed:', removed_item)

# Remove the last item
last_item = numbers.pop()
print(numbers)
print('Last removed:', last_item)

Output:


[10, 20, 40]
Removed: 30
[10, 20]
Last removed: 40

Using pop() with no argument removes the last element. This is a quick way to shrink a list from the end. If you specify an index that is out of range, you will get an IndexError.

Using the del Statement

The del statement is more flexible. It can remove a single item by index or a slice of items. Unlike pop(), it does not return the removed value. It simply deletes the reference.

This is your go-to tool when you need to delete multiple elements at once or remove an item without caring about its value. For more details on this statement, check out our guide on Python List del: Remove Items Easily.


# Create a list of letters
letters = ['a', 'b', 'c', 'd', 'e']

# Delete the item at index 1
del letters[1]
print(letters)

# Delete a slice from index 1 to 3 (not including 3)
del letters[1:3]
print(letters)

# Delete the entire list
del letters

Output:


['a', 'c', 'd', 'e']
['a', 'e']

After del letters, the list is gone. Accessing it will raise a NameError. The del statement is powerful but should be used with care.

Removing by Index with pop() vs del

Both pop() and del can remove an item by index. The key difference is that pop() returns the removed value, while del does not. Choose pop() when you need the value.

If you only want to delete an item and don't need it afterwards, del is slightly faster. For a deeper comparison, see our article on Python List Remove by Index.


# Example comparing both methods
my_list = [1, 2, 3, 4]

# Using pop to get the value
value = my_list.pop(1)
print('Popped value:', value)

# Using del to just remove
del my_list[0]
print('After del:', my_list)

Output:


Popped value: 2
After del: [3, 4]

In the example, pop(1) returns 2 and removes it. Then del my_list[0] removes 1 from the remaining list. Both methods are valid, but they serve different purposes.

Using List Comprehension to Filter Items

Sometimes you want to remove all items that match a condition. A list comprehension creates a new list without those items. This is a clean and functional approach.

This method is best when you need to remove multiple occurrences based on a rule. It does not modify the original list; it creates a new one. If you want to keep the original, assign the result to a new variable.


# Original list with duplicate values
data = [5, 10, 15, 10, 20, 10]

# Remove all 10s using list comprehension
filtered_data = [x for x in data if x != 10]

print(filtered_data)

Output:


[5, 15, 20]

This creates a new list without the value 10. It's a powerful technique for data cleaning. For example, you can use it to Remove NaN from Python List in data analysis tasks.

Clearing a List with clear()

If you want to remove all items from a list, use the clear() method. It empties the list in place. The list variable still exists but now has a length of zero.

This is simpler than reassigning a new empty list. It also works on lists that are referenced by other variables, because it modifies the same object.


# Create a list
items = [1, 2, 3, 4]

# Clear all items
items.clear()

print(items)

Output:


[]

The output shows an empty list. This method is handy when you want to reuse the list variable for new data.

Practical Tips for Removing Items

When removing items in a loop, be careful. Modifying a list while iterating over it can cause skipped elements. A safe way is to iterate over a copy of the list.

For example, if you want to remove all even numbers, you can loop over a copy. This avoids shifting indices that mess up your iteration.


# List with mixed numbers
nums = [1, 2, 3, 4, 5, 6]

# Iterate over a copy to remove evens safely
for num in nums[:]:
    if num % 2 == 0:
        nums.remove(num)

print(nums)

Output:


[1, 3, 5]

Using nums[:] creates a shallow copy. This prevents index shifting issues. Always use this pattern when removing items in a loop.

Conclusion

Removing items from a Python list is straightforward with the right method. Use remove() to delete by value, pop() to delete by index and get the value, and del for flexible deletion of items or slices. List comprehensions are great for conditional removal.

Remember to handle errors like ValueError and IndexError when necessary. Always test your code with sample lists to ensure it behaves as expected. With these tools, you can manage list data efficiently in your Python projects.

For more list operations, explore our guides on Python List Append to End and Python List Count: Easy Guide. Happy coding!