Python List remove() Method

The list.remove() method deletes the first item in a list that matches a given value.

Use this method when you know the value you want to remove, not the position. This page focuses on removing by value, not by index.

Quick example

items = ["apple", "banana", "orange"]
items.remove("banana")
print(items)
# ['apple', 'orange']

Use remove(value) to delete the first matching item from a list.

What remove() does

remove() is a list method that:

  • Deletes the first item in the list that matches the value
  • Changes the original list in place
  • Does not return a new list
  • Is useful when you know the item value you want to delete

This is important for beginners:

numbers = [1, 2, 3]
result = numbers.remove(2)

print(numbers)
print(result)

Output:

[1, 3]
None

The list changed, but remove() itself returned None.

Syntax

list.remove(value)
  • value is the item you want to delete
  • Python searches from left to right
  • Only the first matching value is removed

Example:

letters = ["a", "b", "c"]
letters.remove("b")
print(letters)

Output:

['a', 'c']

Basic example

Here is a simple example with strings:

colors = ["red", "blue", "green"]
colors.remove("blue")
print(colors)

Output:

['red', 'green']

What happens here:

  • A list is created with three values
  • remove("blue") deletes the matching item
  • The list is printed after the change

You can use the same method with numbers too:

scores = [10, 20, 30, 40]
scores.remove(30)
print(scores)

Output:

[10, 20, 40]

What happens with duplicates

If the same value appears more than once, remove() deletes only the first one.

items = ["apple", "banana", "apple", "orange"]
items.remove("apple")
print(items)

Output:

['banana', 'apple', 'orange']

Only the first "apple" was removed.

If you want to remove another matching value, call remove() again:

items = ["apple", "banana", "apple", "orange"]
items.remove("apple")
items.remove("apple")
print(items)

Output:

['banana', 'orange']

If you need to remove all matching values, a list comprehension is usually better:

items = ["apple", "banana", "apple", "orange"]
items = [item for item in items if item != "apple"]
print(items)

Output:

['banana', 'orange']

What happens if the value is missing

If the value is not in the list, Python raises a ValueError.

items = ["apple", "banana", "orange"]
items.remove("grape")

Output:

ValueError: list.remove(x): x not in list

This is a common beginner mistake.

A safe pattern is to check first:

items = ["apple", "banana", "orange"]
value = "grape"

if value in items:
    items.remove(value)

print(items)

Output:

['apple', 'banana', 'orange']

This avoids the error because remove() runs only if the value exists.

If you are troubleshooting this kind of problem, see ValueError in Python: causes and fixes.

remove() vs pop()

remove() and pop() both delete items from a list, but they work differently.

  • remove() deletes by value
  • pop() deletes by index
  • remove() returns None
  • pop() returns the removed item

Example with remove():

items = ["apple", "banana", "orange"]
items.remove("banana")
print(items)

Output:

['apple', 'orange']

Example with pop():

items = ["apple", "banana", "orange"]
removed_item = items.pop(1)

print(items)
print(removed_item)

Output:

['apple', 'orange']
banana

Use remove() when you know the item value.

Use pop() when you know the position and want the removed item back.

For more detail, see the Python list pop() method.

remove() vs del

remove() and del are also different.

  • remove() deletes by matching value
  • del deletes by index or slice
  • Use del when you know the position
  • Use remove() when you know the item value

Example with del:

items = ["apple", "banana", "orange"]
del items[1]
print(items)

Output:

['apple', 'orange']

This removed the item at index 1, not the value "banana" directly.

If you are not sure whether you should remove by value or by position, see how to remove an item from a list in Python.

Common mistakes

Here are some common problems when using remove():

  • Trying to remove a value that is not in the list
  • Expecting remove() to delete all matching values
  • Assigning the result of remove() to a variable even though it returns None
  • Using remove() when pop() or del would be a better fit
  • Confusing removing by value with removing by index

Helpful checks while debugging:

print(my_list)
print(value in my_list)
print(my_list.count(value))
print(type(my_list))
help(list.remove)

These checks can help you answer questions like:

  • Is the value really in the list?
  • How many times does it appear?
  • Am I working with a list?
  • Am I using the method correctly?

If you need to find a value before removing it, the Python list index() method may also help.

FAQ

Does remove() delete all matching items?

No. It removes only the first matching value.

What does list.remove() return?

It returns None. It changes the original list directly.

How do I avoid an error if the value is missing?

Check with if value in my_list before calling remove().

Should I use remove() or pop()?

Use remove() for a value and pop() for an index.

See also