[Tutor] How does [::-1] work?

Intercodes intercodes at gmail.com
Thu Jan 19 03:49:07 CET 2006


Hello Everyone,

There was a query in this list regarding reversing a string and someone
suggested that [::-1] does that.

I tried that expression in my intepreter and various other combination but
still can't comprehend how the expression works. I could understand[:] ,
[n:] or  [:n] . But what meaning does it have in using two colons inside
array index while slicing?. A concise explanation would suppress my
curiosity.

Thank You.
--
Intercodes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060119/60db53e5/attachment.htm 


More information about the Tutor mailing list