title: python - efficient way of checking if part of string is in the list
body: <p>I have a huge string like: </p>
  
  <blockquote>
    <p>The Dormouse's story. Once upon a time there were three little
    sisters; and their names were  Elsie, Lacie and Tillie; and they lived
    at the bottom of a well....badword... </p>
  </blockquote>
  
  <p>and I have a list of around 400 bad words: </p>
  
  <pre><code>bad_words = ["badword", "badword1", ....]
  </code></pre>
  
  <p>what is the most efficient way to check if text contains a bad word from badwords list? </p>
  
  <p>I could loop over both text and list like: </p>
  
  <pre><code>for word in huge_string:
     for bw in bad_words_list: 
      if bw in word: 
         # print "bad word is inside text"... 
  </code></pre>
  
  <p>but this seems to me to be from 90's.. </p>
  
  <p><strong>Update:</strong> bad words are single words. </p>