combining the path and fileinput modules SOLVED
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Nov 27 21:57:48 EST 2006
At Sunday 26/11/2006 01:29, wo_shi_big_stomach wrote:
>for line in fileinput.input(g, inplace=1, backup='.bak'):
># just print 2nd and subsequent lines
> if not fileinput.isfirstline():
> print line.rstrip('\n')
> # check first line only
> elif fileinput.isfirstline():
> if not re.search('^From ',line):
> print line.rstrip('\n')
Just a note: the elif is redundant, use a simple else clause.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list