python array remove element by value code example
Example 1: remove value from python list by value
>>> a = ['a', 'b', 'c', 'd']
>>> a.remove('b')
>>> print a
['a', 'c', 'd']
Example 2: python list remove item by value
l = ['Alice', 'Bob', 'Charlie', 'Bob', 'Dave']
print(l)
l.remove('Alice')
print(l)
Example 3: python list remove at index
>>> del a[2:4]
>>> a
[0, 1, 4, 5, 6, 7, 8, 9]
Example 4: delete element from list value
>>> a=[1,2,3]
>>> a.remove(2)
>>> a
[1, 3]
>>> a=[1,2,3]
>>> del a[1]
>>> a
[1, 3]
>>> a= [1,2,3]
>>> a.pop(1)
2
>>> a
[1, 3]
>>>