title: why is regex matching into string output of file.read() different when i assign it to a variable?
body: <p>i am trying to regex match into a yml file, and i have found a situation i don't understand with how read() works in Python.</p>
  
  <p>i’m opening a &lt;4k yaml file as such:
  <code>with open(filename, 'r') as fptr:
  </code></p>
  
  <p>i have three things to compare wrt behavior:</p>
  
  <ol>
  <li>ftpr.read()</li>
  <li>new_file = fptr.read()</li>
  <li>copied the stdout from fptr.read() into variable “filedummy” </li>
  </ol>
  
  <p>if i apply type() around all three, i get 'str'
  if i print each to stdout, they're identical</p>
  
  <p>now if i apply regex:</p>
  
  <pre><code>print [match for match in re.findall(YAML_PATTERN, filedummy, flags=re.MULTILINE)], "&lt;=== matches"
  print [match for match in re.findall(YAML_PATTERN, new_file, flags=re.MULTILINE)], "&lt;=== matches"
  print [match for match in re.findall(YAML_PATTERN, fptr.read(), flags=re.MULTILINE)], "&lt;=== NOTHING"
  </code></pre>
  
  <p>note: this behavior still occurs if i do these actions in isolation, so it doesn't seem to be because i'm exhausting the ftpr.read() output</p>