title: Parsing XML using etree in Python
body: <p>I have looked at the documentation and other similar questions and can't work out what's going wrong here!</p>
  
  <p>I want to use the XML output from an API.</p>
  
  <p>I have XML that looks a bit like this:</p>
  
  <pre><code>&lt;response&gt;
  &lt;lst&gt;&lt;/lst&gt;
  &lt;result&gt;
      &lt;doc&gt;
          &lt;str name ="pa"&gt;1234&lt;/str&gt;
          &lt;str name ="et"&gt;Title 1&lt;/str&gt;
          &lt;str name ="pb"&gt;Publisher 1&lt;/str&gt;
          &lt;str name ="ur"&gt;http://www.exampleone.com&lt;/str&gt;
      &lt;/doc&gt;
      &lt;doc&gt;
          &lt;str name ="pa"&gt;5678&lt;/str&gt;
          &lt;str name ="et"&gt;Title 2&lt;/str&gt;
          &lt;str name ="pb"&gt;Publisher 2&lt;/str&gt;
          &lt;str name ="ur"&gt;http://www.exampletwo.com&lt;/str&gt;
      &lt;/doc&gt;
  &lt;/result&gt;
  </code></pre>
  
  <p></p>
  
  <p>I want to get the "pa" for each doc element.</p>
  
  <p>This is the code I am using, but get nothing:</p>
  
  <pre><code>import requests
  import xml.etree.ElementTree as ET
  
  r = requests.get("api url goes here")
  
  tree = ET.fromstring(r.content)
  
  for doc in tree.findall("doc"):
      pan = doc.find('pa').text
      print pan
  </code></pre>
  
  <p>What am I doing wrong?</p>