[Tutor] Finding all locations of a sequence

Lauren laurenb01 at gmail.com
Thu Jun 14 20:35:09 CEST 2007


Ok, please bear with me, I'm very new to programming and python. And
my question is rather...convoluted.

I have a bunch of sequences (about 4100 or so), and want to know where
they are in a very, very large string of letters. But wait, there's
more. Some of these sequences match to more than 'word' (for
example...to be consistent with later, chicken could match to poultry
or chicken).

example of what I want to do (on a much smaller scale):

Say I have chicken and I want to know where it occurs in a string of
words, but I want it to match to both chicken and poultry and have the
output of:

chicken  (locations of chicken and poultry in the string)

or something like that.

The string I'm dealing with is really large, so whatever will get
through it the fastest is ideal for me.

I hope this all makes sense...

If it's possible to have pseudocode that would be helpful.


More information about the Tutor mailing list