title: Using python Check a file of unpredicted type for a given word
body: <p>this is a question about programming methodology.</p>
  <p>I'm building a python programme to check files for keywords. The keywords may occur more than one time in a file and, when one is found, I record what the keyword was, the line on which it is if found and the sentence in which it is found.</p>
  <p>The issue I'm hitting is that I can't predict all the file types my programme may meet. So, in order to mitigate this, I've been writing code to handle each instance of file type that my programme might encounter. For example one block of code to handle <code>.txt</code> files, then another to handle <code>.csv</code> files. As I'm doing this, I've been thinking its not very efficient. I'm wondering, is there a way in python to check any file of any given type for a keyword and return the information I'm seeking to index without having to predict all the possible file types and write a case for handling each? If so, how should I be approaching this?</p>
  <p>thanks</p>