python: check if a line has one of the strings in a list
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/3389574/check-if-multiple-strings-exist-in-another-string">Check if multiple strings exist in another string</a>  </p>
</blockquote>



<p>I am trying to find out if there is a nice and clean way to test for 3 different strings.</p>

<p>Basically I am looping trough a file using a for loop; then I have to check if that line contains 1 of the 3 strings that I have set in a list.</p>

<p>So far I have found the multiple if condition check, but it does not feel like is really elegant and efficient</p>

<pre><code>for line in file
    if "string1" in file or "string2" in line or "string3" in line:
        print "found the string
</code></pre>

<p>I was thinking like creating a list that contains string1, string2 and string3, and check if any of these is contained in the line, but it doesn't seems that i can just compare the list without explicitly loop trough the list, and in that case I am basically in the same conditions as in the multiple if statement that I wrote above.</p>

<p>Is there any smart way to check against multiple strings without writing long if statements or loop trough the elements of a list?</p>
