Striding slice?
Bengt Richter
bokr at accessone.com
Mon Aug 27 16:33:57 EDT 2001
On Mon, 27 Aug 2001 07:13:50 GMT, Brian Lee <senux at senux.com.NOSPAM> wrote:
>Bengt Richter wrote:
>> >>> a='0123456789'
>> >>> a[0:5]
>> '01234'
>> >>> a[0:5:2]
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> TypeError: sequence index must be integer
>> >>>
>>
>> How about (faked example):
>> >>> a[0:5:2]
>> '024'
>
>>>> a = '0123456789'
>>>> a[0:5]
>'01234'
>>>> a[0:5][:2]
>'01'
>
I actually did mean '024' ;-)
More information about the Python-list
mailing list