Consecutive Character Sequences

Peter Hansen peter at engcorp.com
Thu Jul 14 02:51:42 CEST 2005


Walter Brunswick wrote:
> Is there any way to [efficiently] iterate through a sequence of characters to find N [or more] consecutive equivalent characters?
> 
> So, for example, the string "taaypiqee88adbbba" would return 1 if the number (of consequtive characters) supplied in the parameters 
> of the function call was 2 or 3, because "a", "e", 8, and "b" is repeated 2 or 3 times.

Why would it return 1?  Is that instead of True, or does it represent a 
count of items, or the position of something in the list, or what?

-Peter



More information about the Python-list mailing list