Pythonic World
Python tips and tricks
Showing posts with label
len
.
Show all posts
Showing posts with label
len
.
Show all posts
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]
.
Older Posts
Home
Subscribe to:
Posts (Atom)