On Mon, Oct 13, 2014 at 10:38 AM, Rff <rw...@avnera.com> wrote:
> Hi,
> I have a text file. Now it is required to select every other line of that 
> text to
>  generate a new text file. I have read through Python grammar, but still lack 
> the
>  idea at the beginning of the task. Could you tell me some methods to get 
> this?

Perhaps something like:
http://stromberg.dnsalias.org/svn/every-nth/trunk

It uses zip and itertools.cycle.

It's CPython 3.x though - if you need 2.x, you'd probably use xrange
instead of range, and izip instead of zip.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to