Match 2 words in a line of file

Rickard Lindberg ricli576 at student.liu.se
Sat Jan 20 01:57:37 EST 2007


Daniel Klein wrote:

> 2) This can be resolved with
>
> templine = ' ' + line + ' '
> if ' ' + word1 + ' ' in templine and ' ' + word2 + ' ' in templine:

But then you will still have a problem to match the word "foo" in a
string like "bar (foo)".




More information about the Python-list mailing list