Copyright © tutorialspoint.com
This method removes and returns last object or obj from the list.
list.pop(obj=list[-1]) |
Here is the detail of parameters:
obj: optional parameter, index of the object to be removed from the list.
It returns removed object from the list.
#!/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 |
Copyright © tutorialspoint.com