title: How to remove attribute from root element in Python xml etree ElementTree
body: <p>My file contains the following data:</p>
  
  <p>Original:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt; &lt;url&gt; &lt;changefreq&gt;daily&lt;/changefreq&gt; &lt;loc&gt;http://www.example.com&lt;/loc&gt;&lt;/url&gt;&lt;/urlset&gt;
  </code></pre>
  
  <p>Expected:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;urlset&gt; &lt;url&gt; &lt;changefreq&gt;daily&lt;/changefreq&gt; &lt;loc&gt;http://www.example.com&lt;/loc&gt;&lt;/url&gt;&lt;/urlset&gt;
  </code></pre>
  
  <p>I use etree to parse the file and I want to remove the attribute from the root element 'urlset'</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  
  tree = ET.parse("/Users/hsyang/Downloads/VI-0-11-14-2016_20.xml")
  root = tree.getroot()
  
  print root.attrib
  &gt;&gt; {}
  
  root.attrib.pop("xmlns", None)
  
  print root.attrib
  &gt;&gt; {}
  ET.tostring(root)
  </code></pre>
  
  <p>I thought I was supposed to get {xmlns:"<a href="http://www.sitemaps.org/schemas/sitemap/0.9" rel="nofollow noreferrer">http://www.sitemaps.org/schemas/sitemap/0.9</a>"} when i print root.attrib the first time but I got an empty dictionary. Can someone help?</p>
  
  <p>Appreciate it! </p>