What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use my_list.remove(value) to remove the first matching value. To remove an item by position, use my_list.pop(index) if you need the removed item, or del my_list[index] if you do not. To remove every match or filter by a condition, build a new list with a comprehension.
Choose the right way to remove a list item
| Goal | Use | What happens | Possible error |
|---|---|---|---|
| Remove the first item equal to a value | items.remove(value) |
Changes the existing list; returns None. |
ValueError if no equal item exists. |
| Remove an item by index and keep it | removed = items.pop(index) |
Changes the existing list and returns the removed item. | IndexError if the list is empty or the index is out of range. |
| Remove an item by index without keeping it | del items[index] |
Changes the existing list; does not return the removed item. | IndexError if the index is out of range. |
| Remove every matching value or apply a condition | [item for item in items if item != value] |
Creates a new list and preserves the order of retained items. | No missing-value error; items that fail the condition are simply excluded. |
Remove an item by value with remove()
Call remove(value) when you know what the item is but not its position. Python removes only the first item equal to that value.
fruits = ["apple", "banana", "apple"]
fruits.remove("apple")
print(fruits) # ['banana', 'apple']
If the value might not be present, check first or handle the exception:
if "pear" in fruits:
fruits.remove("pear")
remove() modifies the list in place and returns None. Do not assign its result back to the list:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors#1 Best Overall
# Incorrect: items becomes None
items = items.remove("banana")
Remove an item by index with pop() or del
Use pop() when you need the removed item
pop(index) removes and returns the item at that position. Python list indexes start at zero, so index 1 refers to the second item. If you omit the index, pop() removes and returns the last item.
colors = ["red", "green", "blue"]
removed = colors.pop(1)
print(removed) # green
print(colors) # ['red', 'blue']
An empty list or an invalid index raises IndexError. Check the list or handle the exception when either case is possible.
Rank #2
Use del when you only need to delete
del removes an item by index without returning it. It can also remove a range using slice notation:
numbers = [10, 20, 30, 40]
del numbers[1] # removes 20
del numbers[1:3] # removes 30 and 40
To empty the existing list while keeping the same list object, use del items[:]. To clear all its items directly, use items.clear().
Remove all matching values or filter by a condition
remove() stops after the first equal value. To remove every occurrence, create a filtered list instead:
items = ["pen", "notebook", "pen", "ruler"]
items = [item for item in items if item != "pen"]
print(items) # ['notebook', 'ruler']
This comprehension creates a new list and keeps the relative order of items that pass the test. The same pattern works for a condition; for example, keep only positive numbers:
numbers = [-3, 0, 4, -1, 7]
positive = [number for number in numbers if number > 0]
print(positive) # [4, 7]
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Avoid removing items while iterating over the same list
Removing items as you move forward through that same list can shift later items into positions the iteration has already passed. As a result, an item that also meets the removal condition may be skipped. When you want to examine every item, a filtered list comprehension is often simpler and safer than modifying the list during iteration.
These behaviors are documented in the Python 3.14.8 data structures tutorial.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




