[Tutor] Detecting sequences in lists

Tino Dai tinoloc at gmail.com
Mon Aug 27 15:20:53 CEST 2007


Hi Everybody,

       Thank you so much for the information on sets. I think that that has
certain uses, but in my case I can't find a way. I have been thinking about
sequences in a list. Let me give you an example:

tset = [ 1,2,4,0,0,1,2,4,4]

What I want to do is detect the 1,2,4 sequence and perhaps how many.

What I have tried is
[1,2,4] in tset

and also

tset.count([1,2,4])

Is there a method or a function that does this in python, or am I left with
DIY?

-Thanks,
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070827/462aec29/attachment.htm 


More information about the Tutor mailing list