Copyright © tutorialspoint.com

Python List pop() Method

previous next


Description:

This method removes and returns last object or obj from the list.

Syntax:

list.pop(obj=list[-1])

Parameters:

Here is the detail of parameters:

Return Value:

It returns removed object from the list.

Example:

#!/usr/bin/python

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

print "A List : ", aList.pop();
print "B List : ", aList.pop(2);

This will produce following result:

A List :  abc
B List :  zara

previous next

Copyright © tutorialspoint.com