title: How to generate a list starting from a string and ending with another?
body: <p>I am trying to read a list of wavelengths from a text file containing a lot of other information but I can't figure out how to make python only start adding to the list after 'wavelength'.  I can get it to end at } however.  I'm sure I'm missing something painfully obvious. My text file has wavelengths stored in this format:</p>
  
  <pre><code>info1 = {xxx}
  info2 = {xxx}
  
  Wavelength = {
  1.1,
  2.2,
  3.3
  }
  
  info3 = {
  1.1,
  2.2
  }
  </code></pre>
  
  <p>I was able to get it to read into a list by finding what lines the data was in and reading in that range, but I want this to be more adaptable.</p>
  
  <pre><code>wavelength = []
  with open(header, 'r') as hdr:
      for line in hdr:
          if 'wavlength' in line:
              #add next lines to list until }
              if float in line:
                  if '}' in line:
                      break
      wavelength.append(line)
  print(wavelength)
  
  #output I want
  [1.1,2.2,3.3]
  #output I get
  ['}\n']
  </code></pre>
  
  <p>I know how to remove special characters and new lines so I'm not worried about that so much as reading the next lines until I hit }.</p>