title: Extract x and y data from a text
body: <p>I am very new to python and know a little bit about data structures and retrieving things, and I was wondering if someone could point me in the right direction.
  I have a text file that has a structure like this (with 17000 or so data points). It's not XML (although looks similar), the data looks exactly like this:</p>
  
  <pre><code>&lt; begin &gt;
      &lt; datapt &gt; 1 &lt; datapt &gt;
      &lt; xunit &gt; mass &lt; xunit &gt;
      &lt; xval &gt; 150.000097 &lt; xval &gt;
      &lt; yunit &gt; abs &lt; yunit &gt;
      &lt; yval &gt; 0.000000 &lt; yval &gt;
  &lt; end &gt;
  
  &lt; begin &gt;
      &lt; datapt &gt; 2 &lt; datapt &gt;
      &lt; xunit &gt; mass &lt; xunit &gt;
      &lt; xval &gt; 150.000245 &lt; xval &gt;
      &lt; yunit &gt; abs &lt; yunit &gt;
      &lt; yval &gt; 0.000000 &lt; yval &gt;
  &lt; end &gt;
  </code></pre>
  
  <p>I would like to extract all the x values and the y values in this text (using python), and make a .csv file that has two separate columns for x values  and the y values .</p>
  
  <p>How would I begin to construct this particular code? Should I have an easier time with RegEx? Moreover, should I try to somehow convert this into an XML-like format to make it much easier to just slap it into excel? </p>
  
  <p>Any pointers is appreciated!!</p>