return the last item in a list

Raymond Hettinger vze4rx4y at verizon.net
Wed Mar 30 13:04:21 EST 2005


[David Bear]
> I'm looking for an 'easy' way to have the last item in a list returned.

Try mylist.pop() or mylist[-1].


Raymond Hettinger





More information about the Python-list mailing list