Beautiful soup missing some html table tags
<p>I'm trying to extract data from a website using beautiful soup to parse the html. I'm currently trying to get the table data from the following webpage :</p>

<p><a href="http://www.installationsclassees.developpement-durable.gouv.fr/ficheEtablissement.php?selectRegion=-1&amp;selectDept=-1&amp;champcommune=&amp;champNomEtabl=&amp;selectRegSeveso=-1&amp;selectRegEtab=-1&amp;selectPrioriteNat=-1&amp;selectIPPC=-1&amp;champActivitePrinc=-1&amp;champListeIC=&amp;selectDeclaEmi=&amp;champEtablBase=544&amp;champEtablNumero=18&amp;ordre=&amp;champNoEnregTrouves=4480&amp;champPremierEnregAffiche=0&amp;champNoEnregAffiches=20" rel="nofollow">link to webpage</a></p>

<p>I want to get the data from the table. First I save the page as an html file on my computer (this part works fine, I checked that I got all the information) but when I try to parse with the following code :</p>

<pre><code>soup = BeautifulSoup(fh, 'html.parser')
table = soup.find_all('table') 
cols = table[0].find_all('tr')
cells = cols[1].find_all('td')`
</code></pre>

<p>I don't get any results (specifically it crashes, saying there's no element at index 1). Any idea of where it could come from?</p>

<p>Thanks</p>

<p>Ok actually it was an issue in the html file, in the first line the html tags were opened with th but closed with td. I don't know much about HTML but replacing the th by td solved the issue.</p>

<pre><code>&lt;tr class="listeEtablenTete"&gt;
&lt;th title="Rubrique IC"&gt;Rubri. IC&lt;/td&gt;
&lt;th title="Alin&amp;eacute;a"&gt;Ali.&amp;nbsp;&lt;/td&gt;
&lt;th title="Date d'autorisation"&gt;Date auto.&lt;/td&gt;
&lt;th &gt;Etat d'activit&amp;eacute;&lt;/td&gt;
&lt;th title="R&amp;eacute;gime"&gt;R&amp;eacute;g.&lt;/td&gt;
&lt;th &gt;Activit&amp;eacute;&lt;/td&gt;
&lt;th &gt;Volume&lt;/td&gt;
&lt;th &gt;Unit&amp;eacute;&lt;/td&gt;`
</code></pre>

<p>Thanks !</p>

python beautifulsoup