Pythonic World
Python tips and tricks
Tuesday, 25 November 2008
Last element standing
To access the last element in a list, there's no need for the long-winded
list[len(list) - 1]
.
All that's needed is
list[-1]
.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment