On Oct 19, 3:53 pm, Jabba Laci <jabba.l...@gmail.com> wrote: > Would someone explain how str[::-1] work? I'm new to Python and I only > saw so far the str[begin:end] notation. What is the second colon?
Slice notation is of the form [start:stop:step]. start defaults to the start of the sequence, stop to the end, and step to 1. So a slice of [::-1] returns the full sequence in reverse, stepping back one character at a time from the end of the sequence to the beginning. The only mention I could find was http://docs.python.org/dev/3.0/library/functions.html#slice -- http://mail.python.org/mailman/listinfo/python-list