[Tutor] Introduction - log exercise

Alan Gauld alan.gauld at btinternet.com
Wed Nov 18 09:38:23 CET 2009


"bob gailer" <bgailer at gmail.com> wrote

>> "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)
>>
>
> No - that misses the objective of eliminating blocks containing 'foo'

Yeah, I was assuming "block" referred to a line not a paragraph.
I was simply extending the original post to remove the line if it
contained 'foo' rather than just being 'foo'. But it has since become
obvious that the OP needs more than that!

Alan G. 




More information about the Tutor mailing list