title: How to parse a text file into variables and a list
body: <p>I have a text file which looks like:</p>
  <pre><code>2.34 5.32 4.3 [1, 6,-5, 112] other stuff
  12.11 5.3 1.93 [11, -6, 55, -12] other stuff
  </code></pre>
  <p>That is each line has three floating point numbers followed by a list and after the list there is some other stuff. I would like to read it in a line at a time and get the three floating point numbers and the  list in four different variables.  I can get all the lines with:</p>
  <pre><code>with open(&quot;test.txt&quot;, &quot;r&quot;) as f:
      lines = f.read().splitlines()
  </code></pre>
  <p>But I don't know how to then go through the lines and extract the floating point numbers and the list.</p>
  <pre><code>for line in lines:
      a, b, c, list_of_integers = parse(line)  # How can you implement parse?
      # do something with a, b, c, list_of_integers
  
  
  def parse(line):
      # ....
  </code></pre>