Re: string[i:j:k]

2008-07-22 Thread Terry Reedy
konstantin wrote: Hello, I'm not a newbie in python, but recently faced a problem in simple expression: some_string[i:j:k] What does it mean? I believe this grammar (http://docs.python.org/ref/ slicings.html) describes the syntax. But I can't grasp it. When you post a link, please put it on

Re: string[i:j:k]

2008-07-22 Thread konstantin
Now it's clear. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: string[i:j:k]

2008-07-21 Thread John McMonagle
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*

Re: string[i:j:k]

2008-07-21 Thread Gary Herron
konstantin wrote: On Jul 22, 9:18 am, alex23 <[EMAIL PROTECTED]> wrote: On Jul 22, 3:10 pm, konstantin <[EMAIL PROTECTED]> wrote: some_string[i:j:k] What does it mean? i = start position, j = end position, k = step size s = "ABABABABABABAB" s[0:6:2] 'AAA'

Re: string[i:j:k]

2008-07-21 Thread konstantin
On Jul 22, 9:18 am, alex23 <[EMAIL PROTECTED]> wrote: > On Jul 22, 3:10 pm, konstantin <[EMAIL PROTECTED]> wrote: > > > some_string[i:j:k] > > What does it mean? > > i = start position, j = end position, k = step size > > >>> s = "ABABABABABABAB" > >>> s[0:6:2] > 'AAA' > >>> s = "ABCABCABCABCABC" >

Re: string[i:j:k]

2008-07-21 Thread alex23
On Jul 22, 3:10 pm, konstantin <[EMAIL PROTECTED]> wrote: > some_string[i:j:k] > What does it mean? i = start position, j = end position, k = step size >>> s = "ABABABABABABAB" >>> s[0:6:2] 'AAA' >>> s = "ABCABCABCABCABC" >>> s[0:6:3] 'AA' Hope this helps. - alex23 -- http://mail.python.org/mai

string[i:j:k]

2008-07-21 Thread konstantin
Hello, I'm not a newbie in python, but recently faced a problem in simple expression: some_string[i:j:k] What does it mean? I believe this grammar (http://docs.python.org/ref/ slicings.html) describes the syntax. But I can't grasp it. Thanks! -- http://mail.python.org/mailman/listinfo/python-list