title: How to output each line in a file which contains any of the strings in a list
body: <p>What I have so far:</p>
  
  <pre><code>def FileSearch(filename, items):
      try:
          filehandle = open( filename, "r" )
          linenumber = 0
          for line in filename:
              linenumber +=1
              for item in items:
                  if item in line:
                      print("%2i - %s" %( linenumber, line), end="")
      except IOError:
          print("Error file cannot be read or file does not exist")
          print("Please try again")
  </code></pre>
  
  <p>I'm trying to print lines, preceded by their linenumber, that contain any of the strings contained in the list 'items'. So it would output something like this:</p>
  
  <pre><code>&gt;&gt;&gt;FileSearch("textfile",["this","and","is"])
  2 - this is the 2nd line
  4 - hello and goodbye
  5 - this is a very basic example
  </code></pre>
  
  <p>But when I run the program I'm not even getting an error, nothing happens it just runs to the next line.
  I'd appreciate any help.
  I was wondering also if there was a way to print the lines in numerical order or would the program do it itself here?</p>