Copyright © tutorialspoint.com

Python List remove() Method

previous next


Description:

This method removes first obj from the list.

Syntax:

list.remove(obj)

Parameters:

Here is the detail of parameters:

Return Value:

It returns none but removes the given object from the list.

Example:

#!/usr/bin/python

aList = [123, 'xyz', 'zara', 'abc', 'xyz'];

aList.remove('xyz');
print "List : ", aList;
aList.remove('abc');
print "List : ", aList;

This will produce following result:

List :  [123, 'zara', 'abc', 'xyz']
List :  [123, 'zara', 'xyz']

previous next

Copyright © tutorialspoint.com