title: Read multiple block of file between start and stop flags
body: <p>I am trying to read sections of a file into numpy arrays that have similar start and stop flags for the different sections of the file.  At the moment I have found a method that works, but for only one section of the input file before needing to re open the input file.</p>
  
  <p>My code at the moment is:</p>
  
  <pre><code>    with open("myFile.txt") as f:
          array = []
          parsing = False
          for line in f:
              if line.startswith('stop flag'):
              parsing = False
          if parsing:
              #do things to the data
          if line.startswith('start flag'):
              parsing = True
  </code></pre>
  
  <p>I found the code from this <a href="https://stackoverflow.com/questions/11732383/python-read-specific-lines-of-text-between-two-strings?rq=1">question</a></p>
  
  <p>With this code I need to re-open and read through the file.  </p>
  
  <p>Is there a way to read all sections without having to open the file for each section to be read?</p>