title: Why xroot.iter() can print XPath, but can't return as list of XPath's in Python?
body: <p>My XML file:</p>
  
  <pre><code>&lt;root xmlns:h="http://www.w3.org/TR/html4/"
  xmlns:f="https://www.w3schools.com/furniture"&gt;
  
  &lt;h:table&gt;
    &lt;h:tr&gt;
      &lt;h:td&gt;Apples&lt;/h:td&gt;
      &lt;h:td&gt;Bananas&lt;/h:td&gt;
    &lt;/h:tr&gt;
  &lt;/h:table&gt;
  
  &lt;f:table&gt;
    &lt;f:name&gt;African Coffee Table&lt;/f:name&gt;
    &lt;f:width&gt;80&lt;/f:width&gt;
    &lt;f:length&gt;120&lt;/f:length&gt;
  &lt;/f:table&gt;
  
  &lt;/root&gt;
  </code></pre>
  
  <p>The following code output does only return an xmlns link.</p>
  
  <pre><code>def loopGroup(xml_file,df_cols):
  
      ndf=pd.DataFrame()
      xtree = et.parse(xml_file)
      xroot = xtree.getroot()
      out_xml = pd.DataFrame(columns=df_cols)
  
      for node in xroot.iter():
          data=node.tag,node.attrib
          return data
  </code></pre>
  
  <p>However, if I change to code below:</p>
  
  <pre><code>for node in xroot.iter():
      data=node.tag,node.attrib
      print(data)
  </code></pre>
  
  <p>It will print out like following (my expected output):</p>
  
  <pre><code>    ('root', {})
  ('{http://www.w3.org/TR/html4/}table', {})
  ('{http://www.w3.org/TR/html4/}tr', {})
  ('{http://www.w3.org/TR/html4/}td', {})
  </code></pre>
  
  <p>How do I put these expected output above convert to csv?</p>