Latest web development tutorials

Python3 List remove () method

Python3 list Python3 list


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/python3

list1 = ['Google', 'w3big', 'Taobao', 'Baidu']
list1.remove('Taobao')
print ("列表现在为 : ", list1)
list1.remove('Baidu')
print ("列表现在为 : ", list1)

Examples of the above output results are as follows:

列表现在为 :  ['Google', 'w3big', 'Baidu']
列表现在为 :  ['Google', 'w3big']

Python3 list Python3 list