【发布时间】:2020-11-20 10:47:04
【问题描述】:
在 HTML 中,我想找到包含粗体文本“风险因素”的标签的索引。我的文件格式不同,但它们有一些相似之处。以下是一些示例:
<TABLE width="100%" border="0" cellpadding="2" cellspacing="0" style="font-size: 10pt; background: transparent; color: #000000">
<TR valign="top">
<TD nowrap width="5%"><B>Item 1A.</B></TD>
<TD width="1%"> </TD>
<TD width="94%"><B>Risk Factors</B></TD>
</TR>
</TABLE>
或
<DIV align="left" style="font-size: 11.5pt;color: #000000; background: #ffffff; margin-top: 12pt; margin-left: 0; margin-right: 0; margin-bottom: 0; ">
<B><FONT color="#002868">Item 1A.</FONT> <BR>
Risk Factors</B>
</DIV>
或
<DIV align="left" style="font-size: 11pt;color: #000000; background: #ffffff;">
<B><I>Risk Factors</I></B>
</DIV>
请注意,在最后一个示例中, 标记不直接包含文本,而是通过 标记。我必须限制为粗体文本,因为其他标签可能包含包含非粗体“风险因素”的不相关文本。
谢谢。
【问题讨论】:
标签: html beautifulsoup html-parsing