Python parsing html mismatched tag error
<pre><code>30   &lt;li class="start_1"&gt;
31               &lt;input type="checkbox" name="word_ids[]" value="34" class="list_check"&gt;
32          &lt;/li&gt; 
</code></pre>

<p>This is a part of html file that I want to parse. But when I applied </p>

<pre><code>uh = open('1.htm','r')
data = uh.read()
print data  
tree = ET.fromstring(data)
</code></pre>

<p>It showed</p>

<blockquote>
  <p>xml.etree.ElementTree.ParseError: mismatched tag: line 32, column 18</p>
</blockquote>

<p>I don't know what is going wrong?</p>

<p>You are trying to parse HTML with an <em>XML parser</em>; the latter doesn't have a concept of <code>&lt;input&gt;</code> not having a closing tag.</p>

<p>Use an actual HTML parser; if you want to access the result with an ElementTree-compatible API, use the <code>lxml</code> project, which <a href="http://lxml.de/lxmlhtml.html" rel="nofollow">includes an HTML parser</a>. Otherwise, use <a href="https://www.crummy.com/software/BeautifulSoup/bs4/" rel="nofollow">BeautifulSoup</a> (which can use <code>lxml</code> under the hood as the parsing engine).</p>

python html parsing