[Tutor] returning the entire line when regex matches

Alan Gauld alan.gauld at btinternet.com
Mon May 4 00:21:11 CEST 2009


"Alan Gauld" <alan.gauld at btinternet.com> wrote

>> How do I make this code print lines NOT containing the string 'Domains'?
>>
>
> Don't use regex, use in:
>
> for line in log:
>     if "Domains" in line:
>         print line

Should, of course,  be

       if "Domains" not in line:
           print line

Alan G.




More information about the Tutor mailing list