Striding slice?

Brian Lee senux at senux.com.NOSPAM
Mon Aug 27 03:13:50 EDT 2001


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'




More information about the Python-list mailing list