title: Python re.findall from file
body: <p>I am trying to extract all of the text between two keywords in a text file. The keywords appear multiple times in the file, so I will have multiple blocks of good text.  </p>
  
  <p>The input.txt file is this:</p>
  
  <pre><code>bad bad keyword1 GOOD DATA keyword2 bad
  bad bad bad keyword1 MORE 
  GOOD DATA keyword2 bad bad 
  </code></pre>
  
  <p>This is not working: </p>
  
  <pre><code>import re
  
  f = open('input.txt', 'r')
  trim = re.findall('keyword1(.+?)keyword2', f.read())
  print trim
  </code></pre>
  
  <p>It returns an empty list:</p>
  
  <pre><code>[]
  </code></pre>