Python List remove () method
description
remove () function is used to remove a value list the first match.
grammar
remove () method syntax:
list.remove(obj)
parameter
- obj - the object list to be removed.
return value
This method does not return a value, but will be removed in two kinds of the first occurrence of a value.
Examples
The following example shows the remove () method using the function:
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 'xyz']; aList.remove('xyz'); print "List : ", aList; aList.remove('abc'); print "List : ", aList;
Examples of the above output results are as follows:
List : [123, 'zara', 'abc', 'xyz'] List : [123, 'zara', 'xyz']