Python List remove method with Example – Python Tutorial

3 weeks ago codedestine 0

In this tutorial, we will learn about python list remove method.
Python List Remove

remove method :

This method is used to remove ( delete ) the first occurrence of an element ( item ) passed as an argument from the list object.

Syntax : < List Object >.remove( item ) 

Example:

# create list object and assign it to variable l l = ['a','b','c','d','e','a'] # call remove() method by passing 'a' as an argument l.remove('a') # print the list, to check its elements print(l)

References :-

  1. remove method Docs

That’s all for Python List remove method. If you liked it, please share your thoughts in comments section and share it with others too.

Previous