title: Searching a text file for every word in a list and print the lines
body: <p>I would like to search a .txt file for a "list" of words and print any line in the txt that contains any words in the wordlist.</p>
  
  <p>I firstly used <code>.split()</code> to split out the <code>raw_input</code> (called <code>userInput</code>) and got a wordlist. After that I filtered the current wordlist with another blacklist wordlist and got a final filtered wordlist. I want to search the text file for any of its words in this case.</p>
  
  <pre><code>exWords = ['Who', 'How', 'What', 'How many', 'How much', 'am', 'is', 'are', '?', '!']
  while True:
      userInput = raw_input("&gt; ")
      uqWords = userInput.split()
      fqWords = [word for word in uqWords if not any(bad in word for bad in exWords)]
  </code></pre>
  
  <p>After I took <code>userInput</code> apart with <code>.split()</code> and called it <code>uqWords</code> I filtered them from any words in the <code>exWords</code> list and called the output <code>fqWords</code>. Now I want to search <code>Database.txt</code> for any word in the <code>fqWords</code> list and print the lines.</p>
  
  <p>to be specified; my full code is:</p>
  
  <pre><code>import time
  import random
  
  Error = ["Sorry, I don't understand.", "I don't get it"]
  exWords = ['Who', 'How', 'What', 'How many', 'How much', 'am', 'is', 'are', '?', '!']
  R = "Rel &gt; "
  
  while True:
      userInput = raw_input("&gt; ")
      uqWords = userInput.split()
      fqWords = [word for word in uqWords if not any(bad in word for bad in exWords)]
      DB = open("Database.txt")
      for line in DB:
          if fqWords in line:
              print (R + line[:-1])
      CDB = open("CodeDB.txt")
      for code in CDB:
          if fqWords in code:
              print (R + code[:-1])
              break
          if fqWords not in (code and line):
              randomError = random.choice(Error)
              print (R + (randomError))
  </code></pre>