gpt4 book ai didi

用于计算网页中存在的字体标签的 Python 代码

转载 作者:行者123 更新时间:2023-12-04 16:20:44 26 4
gpt4 key购买 nike

我需要计算存在的字体标签的数量。

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7" rowspan="2">&nbsp;</td>
<td width="40%"> <div align="left">
</div>
</td><td width="7" rowspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2">
<b><font face="Arial, Helvetica, sans-serif" size="2">Account #: 8428995632 </font></b><br /><table border="1" width="100%" align="center" cellspacing="0"><tr><td align="left" colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Billing Date: </b><br />07-22-2013</font></td><td align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Past Due Date: </b><br />08-12-2013</font></td></tr><tr><td align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Service From: </b><br />06-11-2013</font></td><td align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Service To: </b><br />07-11-2013</font></td><td align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Days of Service: </b><br />30</font></td></tr><tr><td align="left" colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Current Charges: </b>$30,488.60</font></td><td align="left"><font face="Arial, Helvetica, sans-serif" size="2"><b>Amount Due: </b>$30,488.60</font></td></tr></table></td></tr></table><p></p><p></p><p></p><p><center><font face="Arial, Helvetica, sans-serif" size="3"><b> Meter readings for this bill:</b></font></center><table border="1" width="100%" align="center" cellspacing="0"><tr bgcolor="#FFF2D7"><td align="center" width="18%"><font face="Arial,Helvetica, sans-serif" size="2"><b>Meter</b></font></td><td align="center" width="17%"><font face="Arial, Helvetica, sans-serif" size="2"><b>Service<br />From</b></font></td><td align="center" width="17%"><font face="Arial, Helvetica, sans-serif" size="2"><b>Service<br />To</b></font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2"><b># Days</b></font></td><td align="center" width="10%"><font face="Arial, Helvetica, sans-serif" size="2"><b>Prior<br />Read</b></font></td><td align="center" width="10%"><font face="Arial, Helvetica, sans-serif" size="2"><b>Current<br />Read</b></font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2"><b>Consumption</b></font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">S10406906</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">134</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">144</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">10</font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">08400002</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">30748</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">32634</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">1886</font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">S10406911</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">2717</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">3046</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">329</font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">08405704</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">23755</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">25100</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">1345</font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">S10406895</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">97</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">101</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">4</font></td></tr><tr><td align="center" width="8%"><font face="Arial,Helvetica,sans-serif" size="2">S10406893</font></td><td align="center" width="18%"><font face="Arial, Helvetica, sans-serif" size="2">06-11-2013</font></td><td align="center" width="12%"><font face="Arial, Helvetica, sans-serif" size="2">07-11-2013</font></td><td align="center" width="8%"><font face="Arial, Helvetica, sans-serif" size="2">30</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">7915</font></td><td align="center" width="22%"><font face="Arial, Helvetica, sans-serif" size="2">8406</font></td><td align="center" width="16%"><font face="Arial, Helvetica, sans-serif" size="2">491</font></td></tr></table><input type="hidden" name="BillId" value="842892230704" />

在这我需要计算字体标签的数量,如果可能的话我需要计算这个模式

8406491

请注意字体开始标记后有一个数字,可以是动态的。

提前致谢

最佳答案

下面是一个计算font数量的例子html代码中的标签:

soup = BeautifulSoup("file.html")
fontlist = soup.findAll('font')
print len(fontlist)

关于用于计算网页中存在的字体标签的 Python 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18442003/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com