a question about s[i:j] when i is negative

Fredrik Lundh fredrik at pythonware.com
Tue Oct 17 04:56:54 EDT 2006


"dracula571" wrote:

>> 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

sure, but what makes you think you should add the length twice?

</F> 






More information about the Python-list mailing list