I am trying to scrape a html page and I know there are htmlSei que existem parsers but since the html is not well structured I need to mix it with some regular expressionsde HTML, mas como o meu HTML não está bem estruturado, preciso usar também expressões regulares.
The html im trying to scrape looks like thisO HTML é assim:
<tr bgcolor="#CCCCCC">
<td colspan="2"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">1º
Período Ideal</span></font></td>
<td><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">Créd.<br/>
Aula</span></font></td>
<td><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">Créd.<br/>
Trab.</span></font></td>
<td align="center"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">CH</span></font></td>
<td align="center" width="6%"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">CE</span></font></td>
<td align="center" width="6%"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">CP</span></font></td>
<td align="center" width="6%"><font color="#000000" face="Verdana, Arial, Helvetica, sans-serif" size="1"><span class="txt_arial_8pt_black">ATPA</span></font></td>
</tr>
And my regular expression looks like thisE a regex é:
r'''<span class="txt_arial_8pt_black">(.*?)</span>'''
I'm trying to get the '1º Período Ideal' bitEstou tentando pegar o texto '1º Período Ideal'
, but somehow it doesn't get recognized by this regular expression although some other bits of the code do get recognizedmas a regex não o reconhece, such as the 'CE'embora outros trechos sejam reconhecidos, 'CP'como 'CE'
, 'ATPA' which for me look the same as the bit I want to get. But I don't understand why'CP'
e 'ATPA'
, e eu não entendo o motivo.
Can somebody help me please?