Easy Tutorial
❮ Python Area Triangle Python Clear List ❯

Python3 List remove() Method

Python3 List


Description

The remove() function is used to remove the first occurrence of a specified value from the list.

Syntax

Syntax for the remove() method:

list.remove(obj)

Parameters

Return Value

This method does not return any value but removes the first occurrence of the specified value from the list.

Example

The following example demonstrates the use of the remove() function:

#!/usr/bin/python3

list1 = ['Google', 'tutorialpro', 'Taobao', 'Baidu']
list1.remove('Taobao')
print("The list is now : ", list1)
list1.remove('Baidu')
print("The list is now : ", list1)

The output of the above example is as follows:

The list is now :  ['Google', 'tutorialpro', 'Baidu']
The list is now :  ['Google', 'tutorialpro']

Python3 List

❮ Python Area Triangle Python Clear List ❯