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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to