[Tutor] Introduction - log exercise

Alan Gauld alan.gauld at btinternet.com
Tue Nov 17 23:11:39 CET 2009


"Antonio de la Fuente" <toni at muybien.org> wrote 

> > if not line.isspace() and not line == 'foo':
> >     fileOut.write(line)
> 
> But then, the new log file will have all the blocks, even the ones that
> had 'foo' on it, even if the foo lines weren't there anymore. No? or
> is there anything that I don't get?

I think the test should be:

if not line.isspace and 'foo' not in line:
     fileOut.write(line)

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list