与.renderContents
此处类似,我想按该值进行搜索:Beautiful Soup [Python] and the extracting of text in a table
示例 HTML:
<table>
<tr>
<td>
This is garbage
</td>
<td>
<td class="thead" style="font-weight:normal">
<!-- status icon and date -->
<a name="post1"><img class="inlineimg" src="img.gif" alt="Old" border="0" title="Old"></a>
19-11-2010, 04:25 PM
<!-- / status icon and date -->
</td>
<td>
This is garbage
</td>
</tr>
</table>
我尝试了什么:
soup.find_all("td", text = re.compile('(AM|PM)'))[0].get_text().strip()
但是, 的text
参数find_all
似乎不适用于此应用程序:IndexError: list index out of range
我需要做什么?