[Tutor] indexing a list

Spyros Charonis s.charonis at gmail.com
Thu Oct 18 14:01:59 CEST 2012

Hello pythoners,

I have a string that I want to read in fixed-length windows.

In [68]: SEQ

I would like a function that reads the above string, 21 characters at a
time, and checks for certain conditions, i.e. whether characters co-occur
in other lists I have made. For example:

x = 21   # WINDOW LENGTH

In [70]: SEQ[0:x]

In [71]: SEQ[x:2*x]

In [72]: SEQ[2*x:3*x]

How could I write a function to automate this so that it does this from
SEQ[0] throughout the entire sequence, i.e. until len(SEQ)?

Many thanks for your time,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121018/5e5514cb/attachment.html>

More information about the Tutor mailing list