On Saturday, October 28, 2017 at 4:46:03 PM UTC+5:30, Christian Gollwitzer
wrote:
> Am 28.10.17 um 09:04 schrieb Rustom Mody:
> > [The other day I was writing a program to split alternate lines of a file;
> > Apart from file-handling it was these two lines:
> >
> > for x in lines[0::2]: print(x.strip())
> > for x in lines[1::2]: print(x.strip())
> > ]
>
> ...and using the best(TM) tool for it, it is a one-liner:
>
> gawk '{ print > "split" NR%2}' input.txt
Ooooooo!ยก!
--
https://mail.python.org/mailman/listinfo/python-list