Possible Duplicate:
Good Primer for Python Slice Notation
I first ran across it last night for reversing a string "Hello"[::-1]
and I can't figure out how it actually works.
"Hello"[::-1] # returns "olleH"
[1,2,3,4,5][::-1] # returns [5,4,3,2,1]
"Hello"[1:5:1] # returns "ello"
"Hello"[1:5:2] # returns "el"
My searches for "third expression in python index" have come up empty. What is this expression and how does it work. Obviously ::-1 reverses the list but I can't figure out what the other, positive values represent.