How to parse XML file in Python when the value of an attribute is integer instead of character string
<p>I try to parse the XML file looks like:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;config&gt;
    &lt;basic logdir = "../log/" workthreadcnt=1 maxday="180" /&gt;
&lt;/config&gt;
</code></pre>

<p>I used xml.dom.minidom, such as:</p>

<pre><code>from xml.dom.minidom import parse
import xml.dom.minidom

domtree = xml.dom.minidom.parse("cfg.xml")
</code></pre>

<p>and used xml.etree.ElementTree， such as：</p>

<pre><code>import xml.etree.ElementTree as ET

tree = ET.parse("cfg.xml")
</code></pre>

<p>Both of them didn't work until I changed the attribute</p>

<pre><code>workthreadcnt=1
</code></pre>

<p>to</p>

<pre><code>workthreadcnt="1"
</code></pre>

<p>My questions is: If I insist on using the first format，how to make it work ?</p>