title: How to parse a htm file using Beautiful soup
body: <p>I am trying to parse a htm local file using BeautifulSoup.</p>
  
  <p>.htm is filetype. </p>
  
  <pre><code>from bs4 import BeautifulSoup
  with open('locfile.htm') as fp:
     soup = BeautifulSoup(fp, "html5lib")
  print(soup)
  </code></pre>
  
  <p>Trying the three different parsers, but the same result is obtained. 
  Example for the  html5lib </p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;&lt;p&gt;t a b l e   i d = " T a b l a D a t a "   c l a s s = " T a b l a    w i d t h = " 9 0 %  &amp;gt; 
   t r &amp;gt;....
  
  .....
  </code></pre>
  
  <p>and so on. I think that "&amp;gt" is  but is transformed to those string.</p>
  
  <p>Similar results are obtained using <code>html.parser</code> and <code>html5llib</code></p>
  
  <p>How can I do to mantain the tags into the body?</p>
  
  <p>Could it be a wrong parsing operation?</p>
  
  <pre><code>soup.contents
  [&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&amp;lt;table id=........
  ..................
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>but the inner tags have been missing, or transformed into html escape characters</p>
  
  <p>How do I maintain the tags?</p>