What is the usage of remove function in python?
Usage of remove function in python:
Description
remove() function is used to remove a list The first occurrence of a value in .
Syntax
remove() method syntax:
list.remove(obj)
Parameters
obj -- The object to be removed from the list.
Return value
This method has no return value but will remove the first match of a value in the list.
Examples
The following examples show how to use the remove() function:
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 'xyz']; aList.remove('xyz'); print "List : ", aList; aList.remove('abc'); print "List : ", aList;
The output results of the above examples are as follows:
List : [123, 'zara', 'abc', 'xyz'] List : [123, 'zara', 'xyz']
Recommended tutorial: "python video tutorial"
The above is the detailed content of What is the usage of remove function in python?. For more information, please follow other related articles on the PHP Chinese website!