title: Get list of XML attribute values in Python
body: <p>I need to get a list of attribute values from child elements in Python.</p>
  
  <p>It's easiest to explain with an example.</p>
  
  <p>Given some XML like this:</p>
  
  <pre><code>&lt;elements&gt;
      &lt;parent name="CategoryA"&gt;
          &lt;child value="a1"/&gt;
          &lt;child value="a2"/&gt;
          &lt;child value="a3"/&gt;
      &lt;/parent&gt;
      &lt;parent name="CategoryB"&gt;
          &lt;child value="b1"/&gt;
          &lt;child value="b2"/&gt;
          &lt;child value="b3"/&gt;
      &lt;/parent&gt;
  &lt;/elements&gt;
  </code></pre>
  
  <p>I want to be able to do something like:</p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>&gt;&gt;&gt; getValues("CategoryA")
  ['a1', 'a2', 'a3']
  &gt;&gt;&gt; getValues("CategoryB")
  ['b1', 'b2', 'b3']
  </code></pre>
  
  <p>It looks like a job for XPath but I'm open to all recommendations. I'd also like to hear about your favourite Python XML libraries.</p>