return the last item in a list

Raymond Hettinger vze4rx4y at verizon.net
Wed Mar 30 20:04:21 CEST 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