title: Trouble opening files from a list of closed python files?
body: <p>I have a python list <code>list_of_docs</code> which contains a list of closed .txt files. My goal is to count how many files contain a certain word. </p>
  
  <pre><code>def contains(word):
    count = 0
    for file in range list_of_docs:
      current_doc = open(list_of_docs[file], 'r')
      text = current_doc.read()
      line = text.split()
      if word in line:
        count += 1
  </code></pre>
  
  <p>When I call this function, I keep getting the error:</p>
  
  <pre><code>TypeError: coercing to Unicode: need string or buffer, file found
  </code></pre>
  
  <p>The files in <code>list_of_docs</code>, are actually opened earlier in the code. I close them and reopen them again during this method call because because without closing them I get a <code>Too many files open</code> error. </p>
  
  <p>How I can fix this <code>TypeError</code>?</p>