list delete item code example
Example 1: python list .remove
a = [10, 20, 30, 20]
a.remove(20)
# a = [10, 30, 20]
# removed first instance of argument
Example 2: remove value from python list by value
>>> a = ['a', 'b', 'c', 'd']
>>> a.remove('b')
>>> print a
['a', 'c', 'd']
Example 3: 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]
>>>
Example 4: python list remove all elements
l = [1,2,3,4]
l.clear()