On Dec 30, 4:12 pm, Istvan Albert <[EMAIL PROTECTED]> wrote:
> On Dec 30, 3:29 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>
> > One "recipe" is extracting blocks from text files that are delimited by a
> > special start and end line.
>
> Neat solution!
>
> I actually need such functionality every once in a while.
>
> Takewhile + dropwhile to the rescue!
>
> i.

On at least one thread and a recipe for this task (http://
aspn.activestate.com/ASPN/Cookbook/Python/Recipe/521877), the proposed
solutions involved groupby() with an appropriate key function. The
takewhile/dropwhile solution seems shorter and (maybe) easier to read
but perhaps not as flexible and general. Regardless, it's a good
example of takewhile/dropwhile.

George
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to