To remove the first occurrence of an element, use list.remove:

>>> xs = ['a', 'b', 'c', 'd']
>>> xs.remove('b')
>>> print(xs)
['a', 'c', 'd']

To remove all occurrences of an element, use a list comprehension:

>>> xs = ['a', 'b', 'c', 'd', 'b', 'b', 'b', 'b']
>>> xs = [x for x in xs if x != 'b']
>>> print(xs)
['a', 'c', 'd']
Answer from Johannes Charra on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ gloss_python_array_remove.asp
Python Remove Array Item
You can use the pop() method to remove an element from the array. ... You can also use the remove() method to remove an element from the array. ... Note: The list's remove() method only removes the first occurrence of the specified value.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-remove-array-item
Python Remove Array Item - GeeksforGeeks
July 23, 2025 - This article will cover different methods to remove items from an array in Python. The remove() method removes the first occurrence of a specified value from the array. If the value is not found, it raises a ValueError.
Discussions

How to remove specific element from an array using python - Stack Overflow
I want to write something that removes a specific element from an array. I know that I have to for loop through the array to find the element that matches the content. Let's say that I have an ar... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to remove values to a python array?
Hi, I need to know how to remove values to a python array More on discuss.python.org
๐ŸŒ discuss.python.org
1
0
January 4, 2021
Python: How to remove element by index
Try using the del statement . More on reddit.com
๐ŸŒ r/learnprogramming
9
1
July 25, 2023
how can I remove rows from a numpy array based on a condition
You can use Boolean arrays as index masks. Say you have: >>> import numpy as np >>> M = np.array([[1,2], [3,4],[5,6]]); a = np.array([1, 3]) >>> M == a array([[ True, False], [False, False], [False, False]]) Because of the Numpy's broadcasting rules, a is compared with each row of M. We can apply some sort of reduction to each row: >>> (M == a).any(axis=1) array([ True, False, False]) In your case, you want to remove rows that match this condition, which means you want to keep rows that match the complementary condition, so one of these: >>> ~(M == a).any(axis=1) array([False, True, True]) >>> (M != a).all(axis=1) array([False, True, True]) And you can use that as an index: >>> M[(M != a).all(axis=1)] array([[3, 4], [5, 6]]) More on reddit.com
๐ŸŒ r/learnpython
2
1
February 27, 2023
๐ŸŒ
StrataScratch
stratascratch.com โ€บ blog โ€บ how-to-remove-an-element-from-a-list-in-python
How to Remove an Element from a List in Python - StrataScratch
October 3, 2025 - Use del when you want to delete items by index or slice ranges. Use list comprehension when you want to remove all occurrences of a value or apply a condition. Use filter() when working with functions or filtering logic.
๐ŸŒ
Stack Abuse
stackabuse.com โ€บ remove-element-from-an-array-in-python
How to Remove Elements from an Array/List in Python
September 15, 2023 - We can use the remove() method on any array or list in Python. To use it, we can simply pass the value of the element we want to remove. Let's imagine we have the following array: ... Another way we can remove elements from list/array in Python is by using the pop() method.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ python_remove_array_items.htm
Python - Remove Array Items
Python does not provide built-in support for arrays, however, we can use the array module to achieve the functionality like an array. To remove the first occurrence of a given value from the array, use remove() method.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @reza.shokrzad โ€บ optimized-in-place-element-removal-from-arrays-using-python-00de7f595038
Optimized In-Place Element Removal from Arrays using Python | by Reza Shokrzad | Medium
June 27, 2024 - The key challenge is to achieve this without using additional space for another array, thus maintaining the integrity and order of the original array to the extent necessary. ... Explanation: The function returns k = 2, indicating the first two elements of nums are 2. The remaining elements are irrelevant and can be left unchanged. ... Explanation: The function returns k = 5, with the first five elements of nums containing no 2s. These elements can be in any order, and the spaces beyond k are placeholders. def removeElement(nums, val): i = 0 for j in range(len(nums)): if nums[j] != val: nums[i] = nums[j] i += 1 return i
๐ŸŒ
CodeChef
codechef.com โ€บ learn โ€บ course โ€บ college-data-structures-pyth โ€บ CPDSPY01 โ€บ problems โ€บ CPDSAPY12
Deletion from an array in Data Structures using Python
Test your Data Structures using Python knowledge with our Deletion from an array practice problem. Dive into the world of college-data-structures-pyth challenges at CodeChef.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-remove-an-element-from-an-array-in-Python
How to remove an element from an array in Python - Quora
Answer (1 of 8): Depends what you mean by an array. Let us suppose you want to remove the third item (value 42) in each possibility. In the case of a numpy array, you use the delete() method, using the index (2) of the desired item to remove: [code]import numpy as np s = np.array([11, 21, 42, 6...
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-array-remove-function-in-python
What is the array remove() function in Python?
An array in Python is used to store multiple values of the same type in a single variable. The remove() function is used to remove the first occurrence of a value in a given array.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.2 โ€บ reference โ€บ generated โ€บ numpy.delete.html
numpy.delete โ€” NumPy v2.2 Manual
>>> np.delete(arr, np.s_[::2], 1) array([[ 2, 4], [ 6, 8], [10, 12]]) >>> np.delete(arr, [1,3,5], None) array([ 1, 3, 5, 7, 8, 9, 10, 11, 12])
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.delete.html
numpy.delete โ€” NumPy v2.5 Manual
>>> np.delete(arr, np.s_[::2], 1) array([[ 2, 4], [ 6, 8], [10, 12]]) >>> np.delete(arr, [1,3,5], None) array([ 1, 3, 5, 7, 8, 9, 10, 11, 12])
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ methods โ€บ list โ€บ remove
Python List remove()
The remove() method removes the first matching element (which is passed as an argument) from the list.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Remove an Item from a List in Python: remove, pop, clear, del | note.nkmk.me
April 17, 2025 - In Python, you can remove items (elements) from a list using methods such as remove(), pop(), and clear(). You can also use the del statement to delete items by index or slice. Additionally, list comprehensions can be used to create a new list ...
๐ŸŒ
Python Forum
python-forum.io โ€บ thread-41204.html
How to remove some elements from an array in python?
November 27, 2023 - I have a sorted list of integers that has about 4000 elements. I'm trying to remove every element that is above 550. I used remove() function for the task but it doesn't seem to work. I also looked into pop, tried it and it doesn't seem to work to be...
๐ŸŒ
Medium
medium.com โ€บ @heyamit10 โ€บ different-ways-to-remove-elements-from-a-numpy-array-59a8a7f8fe33
Different Ways to Remove Elements from a NumPy Array | by Hey Amit | Medium
April 18, 2025 - When you need to remove more than one element, numpy.delete() lets you pass a list of indices. However, the key here is that these indices must be provided as a list or an array.
๐ŸŒ
Replit
replit.com โ€บ discover โ€บ how-to-remove-an-element-from-an-array-in-python
How to remove an element from an array in Python
February 20, 2026 - Build and deploy software collaboratively with the power of AI without spending a second on setup.
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ third-party โ€บ numpy โ€บ delete
Python Numpy delete() - Remove Elements | Vultr Docs
November 6, 2024 - The numpy.delete() function in Python is a critical tool for manipulating arrays. It allows you to effortlessly remove elements from an ndarray, which is especially useful in data preprocessing, where you might need to omit data points or adjust ...