[OFF] sed equivalent of something easy in python
mdw at distorted.org.uk
Sat Oct 30 17:14:38 CEST 2010
Jussi Piitulainen <jpiitula at ling.helsinki.fi> writes:
> Daniel Fetchinson writes:
> > The pattern is that the first line is deleted, then 2 lines are
> > kept, 3 lines are deleted, 2 lines are kept, 3 lines are deleted,
> > etc, etc.
> So, is there some simple expression in Python for this?
(item for i, item in enumerate(input) if (i + 4)%5 < 2)
More information about the Python-list