ReferenceList methods
list.remove()
Removes the first item equal to the value.
Signature
items.remove(value)Parameters
| Name | Means |
|---|---|
value | what to look for |
Returns
None. Raises ValueError when there is no match.
Example
Python
names = ["Ada", "Grace", "Ada"]
names.remove("Ada")
print(names)
try:
names.remove("Alan")
except ValueError:
print("not in the list")Output
['Grace', 'Ada'] not in the list