Ide vs ide

Rustom Mody rustompmody at gmail.com
Sat Oct 28 07:39:54 EDT 2017


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!¡!



More information about the Python-list mailing list