title: Exctracting values from a string in python
body: <p>I'm studying an elementary course in programming in python and I have a question.</p>
  
  <p>I have a string in python which includes math information about points, lines and segments.</p>
  
  <p>The string contains a lot of information that has to be ignored. But whenever the words <strong>"point"</strong>,<strong>"line"</strong> or <strong>"segment"</strong> are found, I need to extract the coordinates from such elements and copy them into a list.</p>
  
  <p>I need three different lists. One to store co-ords from points, a second one for lines and a third one for segments.</p>
  
  <p>Since the string is too long, I'll only paste an example of every type of element (I have excluded non relevant parts of the string):</p>
  
  <pre><code>&lt;element type="point" label="D"&gt;
      &lt;show object="true" label="true"/&gt;
      &lt;objColor r="0" g="0" b="255" alpha="0.0"/&gt;
      &lt;layer val="0"/&gt;
      &lt;labelMode val="0"/&gt;
      &lt;animation step="1" speed="1" type="1" playing="false"/&gt;
      &lt;coords x="6.14" y="3.44" z="1.0"/&gt;
      &lt;pointSize val="3"/&gt;
      &lt;pointStyle val="0"/&gt;
  &lt;/element&gt;
  &lt;element type="segment" label="a"&gt;
      &lt;show object="true" label="true"/&gt;
      &lt;objColor r="153" g="51" b="0" alpha="0.0"/&gt;
      &lt;layer val="0"/&gt;
      &lt;labelMode val="0"/&gt;
      &lt;auxiliary val="false"/&gt;
      &lt;coords x="2.68" y="3.44" z="-12.0192"/&gt;
      &lt;lineStyle thickness="2" type="0" typeHidden="1"/&gt;
      &lt;outlyingIntersections val="false"/&gt;
      &lt;keepTypeOnTransform val="true"/&gt;
  &lt;/element&gt;
  &lt;element type="line" label="b"&gt;
      &lt;show object="true" label="true"/&gt;
      &lt;objColor r="0" g="0" b="0" alpha="0.0"/&gt;
      &lt;layer val="0"/&gt;
      &lt;labelMode val="0"/&gt;
      &lt;coords x="-1.3563823178988361" y="3.7135968534106922" z="-13.20117532177342"/&gt;
      &lt;lineStyle thickness="2" type="0" typeHidden="1"/&gt;
      &lt;eqnStyle style="implicit"/&gt;
  &lt;/element&gt;
  </code></pre>
  
  <p>Is there any easy way to do what I want?
  Thanks in advance</p>