title: Read file and perform operation next line onwards after match
body: <p>I am trying to read a tab delimited text file into python. However the file have multiple subheadings. something like this:</p>
  
  <pre><code>a
  [1,2,3]
  [2,3,4]
  [3,2,5,6]
  b
  [1,2,3]
  [2,6,4]
  [7,5,6]
  </code></pre>
  
  <p>i'm trying to write a function that takes the sub-headings as argument and perform a while loop until the next sub heading and return lines below the sub-heading as a list. In pseudocode, this is what i have in mind:</p>
  
  <pre><code>def func(sub-heading):
      outputlist = [ ]
      with open(filepath) as file:
          for line in file:
              if sub-heading:
                  go next line 
                  while not sub-heading:
                      outputlist.append(line.rstrip())
      return outputlist
  </code></pre>
  
  <p>So if i call func(a), i would get the list </p>
  
  <pre><code>[ [1,2,3], [2,3,4], [3,2,5,6] ]
  </code></pre>
  
  <p>But i cant find a way to make the look go into the next line once it found the sub heading.</p>
  
  <p>Any help will be appreciated</p>
  
  <p>Edit for more information</p>