examples/lists/remove.py
from __future__ import print_function

names = ['abc', 'def', 'qqrq', 'moo', 'def']
print(names)                # ['abc', 'def', 'qqrq', 'moo', 'def']

print(names.remove('def'))  # None
print(names)                # ['abc', 'qqrq', 'moo', 'def']

print(names.remove('zorg')) 
   # Traceback (most recent call last):
   #   File "examples/lists/remove.py", line 9, in <module>
   #     print(names.remove('zorg'))  # None
   # ValueError: list.remove(x): x not in list

Remove an element from a list given by its value. Throws an exception if there is no such element in the list.