Python 3 - List remove() Method


Advertisements


Parameters

obj − This is the object to be removed from the list.

Return Value

This method does not return any value but removes the given object from the list.

Example

The following example shows the usage of remove() method.

Live Demo
#!/usr/bin/python3

list1 = ['physics', 'Biology', 'chemistry', 'maths']
list1.remove('Biology')
print ("list now : ", list1)
list1.remove('maths')
print ("list now : ", list1)

Result

When we run above program, it produces the following result −

list now :  ['physics', 'chemistry', 'maths']
list now :  ['physics', 'chemistry']

python_lists.htm

Advertisements