Eric <[EMAIL PROTECTED]> writes: > words is a big long array of strings. What I want to do is find > consecutive sequences of words that have the first letter capitalized, > and then call doSomething on them. (And you can ignore the fact that > it won't find a sequence at the very end of words, that is fine for my > purposes).
As another poster suggested, use itertools.groupby: for cap,g in groupby(words, firstIsCapitalized): if cap: doSomething(list(g)) This will handle sequences at the the end words just like other sequences. -- http://mail.python.org/mailman/listinfo/python-list