Method Name
remove
Method Signature
remove(element_in)
Method Overview
The remove() method removes the first element that matches the value specified by the parameter element_in.
Parameters
element_in:The element to be removed from the python list
Exceptions
ValueError:If the value is not in the list a ValueError is raised stating that the element specified is not in the list.
Example
# Example Python program that removes the first occurence of
# an entry with a specified value from a list
# List of birds
birds = ["Gull", "Parrot", "Peacock", "Penguin", "Robin", "Penguin"]
# Remove the birds which do not fly
birds.remove("Penguin")
print("Birds that can fly:%s"%birds)Output
Birds that can fly:['Gull', 'Parrot', 'Peacock', 'Robin', 'Penguin']