[EMAIL PROTECTED] 写道:
> dracula571 wrote:
> > s[i:j] slice of s from i to j (3), (4)
> >
> > (3)
> > If i or j is negative, the index is relative to the end of the string:
> > len(s) + i or len(s) + j is substituted. But note that -0 is still 0.
> >
Fredrik Lundh 写道:
> dracula571 wrote:
>
> > but k[-6:2] = [1,2]
> > why k[-6:2] is [1,2]not [].i do follow (3),to make i positive by
> > plusing len(k) twice.
>
> twice?
>
>
that is -6 + len(k) + len(k) =4
--
http://mail.python.org/mailman/listinfo/python-list
s[i:j] slice of s from i to j (3), (4)
(3)
If i or j is negative, the index is relative to the end of the string:
len(s) + i or len(s) + j is substituted. But note that -0 is still 0.
(4)
The slice of s from i to j is defined as the sequence of items with
index k such that i <= k < j. If