Remove Element From Python List Using remove()

remove() is a function built into the Python programming language with a specific object removed from the list. No value is returned From remove() Function. For Example list.remove('str1').

Note:- remove() function removes only the first occurrence of the object from the list.

Use Of List Remove Function

Let's Take An Example Of List Remove Function

#List Of Integers
li = [1,2,3,4,5,6,7]
#Remove 2 From List
li.remove(2)

print('Printing List:- ',li)

Output

Printing List [1,3,4,5,6,7]