Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Python – Remove List Element – remove() Function with Examples

remove() function is used to find the given element (x) from the list and remove the very first match of it (x – parameter). remove() method is a part of python standard library.

Syntax of remove() Function

The syntax of remove() function in Python is:


Parameters of remove() Function in Python

x – Where x is an argument that is going to remove from the list. If there are multiple matches available, remove() method will only remove the very first one.  This parameter is required.



remove() function is available and compatible with both Python 2.x and 3.x. This function is one of python list methods.


Return Value of remove() Function in Python

remove() function does not return anything.


Python remove() Function Example 1

['blue', 'yellow', 'green', 'black']


Python remove() Function Example 2

If a list contains duplicate elements. The remove() method removes only the first instance.

['blue', 'yellow', 'red', 'black', 'green', 'orange']

LearnAndLearn.com © 2018 - All rights reserved