finding repeated data sequences in a column

Tim Chase python.list at tim.thechases.com
Wed May 20 12:25:45 EDT 2009


> lets say you have this column of numbers
> 
> 1000028706
> 1000028707
> 1000028708
> 100
> 12
> 1000028706
> 1000028707
> 1000028708
> 1000028709
> 1000028706
> 1000028707
> 1000028708
> 100
> 12
> 6
> 
> How can I build up a program that tells me that this sequence
> 1000028706
> 1000028707
> 1000028708
> is repeated somewhere in the column, and how can i know where?

In your example, would "100,12" also be output, or do you only 
care about the first find?  Do you have a minimum or maximum 
number of repeats you care about?  Is a repeated number a 
"sequence of length 1"?  Can it be capped to know that if you 
have more than N items in common, you don't have to compare more 
than N items from the entire pair of sequences?

-tkc






More information about the Python-list mailing list