title: Find values in file, between keywords, using python
body: <p>I have some file, which have some data like this:</p>
  
  <pre><code>begin of file
  1,2,3,4,5,6,7
  end of file
  </code></pre>
  
  <p>I want read this file, so I have tried:</p>
  
  <pre><code>filename = open('file','r')
  for line in filename:
      print line
  </code></pre>
  
  <p>But now I need to search the keywords like 'begin of file' and 'end of file' in the txt file, then save the values between the 2 keywords to a list.
  I have tried this:</p>
  
  <pre><code>Listsave = []
  filename = open('file', 'r')
  for line in filename:
      if "begin of file" in line:
          listsave.append(line.next())
  </code></pre>
  
  <p>But it is seems like doesnt work.</p>
  
  <p>How can I deal with that?
  thanks a lot</p>