Remove an element from a list in Python

Remove an element from list by index

>>> myList=['a','b','c']
>>> del myList[1]
>>> myList
['a', 'c']

Remove an element from list by value

>>> myList=['a','b','c']
>>> myList.remove('b')
>>> myList
['a', 'c']

See also


Last update : 06/11/2018