Python3 List remove() Method
Description
The remove() function removes the first match of a value from a list.
Syntax
remove() method syntax:
list.remove(obj)
Parameters
- obj -- the object to remove from the list.
Return Value
This method has no return value, but removes the first match of the value from the list.
Example
The following example shows how to use the remove() function:
Example
#!/usr/bin/python3
list1
=
[
'Google'
,
'Runoob'
,
'Taobao'
,
'Baidu'
]
list1.
remove
(
'Taobao'
)
(
"The list is now: "
,
list1
)
list1.
remove
(
'Baidu'
)
(
"The list is now: "
,
list1
)
The output of the above example is:
列表现在为 : ['Google', 'Runoob', 'Baidu']
列表现在为 : ['Google', 'Runoob']
The Python3 list