有一段HTML代码
<tr bgcolor="#cceeff" style="page-break-inside:avoid ; font-family:Def.-Times; font-size:8pt">
<td colspan="3" valign="top"> <p style=" margin-top:0pt ; margin-bottom:0pt; margin-left:2.00em; text-indent:-1.00em; font-size:8pt; font-family:ARIAL"><b>{99}</b> <b></b>Receivables becoming Defaulted Receivables during period</p></td>
<td align="right" valign="bottom"><font style="font-family:ARIAL; ">1,310,326.05</font></td>
<td nowrap="nowrap" valign="bottom"><font style="font-family:ARIAL; "> </font></td>
<td valign="bottom"> </td>
<td valign="bottom"></td>
<td valign="bottom"></td>
我怎样才能提取数据
{4}Defaulted Receivables', '{4}', '1,310,326.05']
我有一个人给我的代码
def get_row(soup, n):
return [td.get_text(strip=True) for td in soup.select('tr:contains("{' + str(n) + '}") td') if td.get_text(strip=True)]
但首先,我不明白如何在 HTML 代码中查找“行”。其次, tr:contains("{' + str(n) + '}") td这段代码是做什么的?抱歉,我对抓取和 HTML 还很陌生
慕尼黑的夜晚无繁华
相关分类