title: Strange behavior (maybe just me) from the python file handling code
body: <p>I just started learning file handling in python3. The code I try to create accepts user provided file name, opens the file, then print out the total number of lines and characters within the file.</p>
  
  <p>The question is that I have to declare different variables (fh and fl in the following example) for the line and character count separately.</p>
  
  <p>In the following working-as-expected code, if I comment out <code>fl = open(fname)</code> line and change <code>for line in fl:</code> to <code>for line in fh</code>, then the line count in the output becomes zero (not expected).</p>
  
  <pre><code>fname = input('Enter the file name: ')
  fh = open(fname)
  text = fh.read()
  fl = open(fname)
  count = 0
  for line in fl:
    count = count + 1
  print("line count in", fname, ":", count)
  print("word count in", fname, ":", len(text))
  </code></pre>
  
  <p>Does that mean in the future if I were to process string functions on the same file, I have to declare different variable and read the same file multiple times? Is there a way to achieve "read once, use many times" goal?</p>