konstantin wrote:

> 
> Thanks!
> It seems that negative step leads in reverse direction.
> But logic isn't completely clear for me.
>>>> s = '123456789'
>>>> s[::-2]
> '97531'
> 
> but
>>>> s[:-1:-2]
> ''
> though I expected something like '8642'
> What did i missed?
> 
> --


You need to *start* at the second from last index:

s[-2::-2]

Regards,

John
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to