【发布时间】:2019-03-10 09:56:48
【问题描述】:
我正在尝试使用 BeautifulSoup 解析 HTML 源代码。我需要得到的是获取特定链接的href(<a> 标签)。我看到的功能是这些链接都在其标签中包含target='testwindow',所以也许我会寻找它。我怎样才能获得这些链接?
这是我的测试样本。我需要仅 http://example.com:20213/testweb1.2/testapp?WSDL。
<td id="link3"><img src="images/spacer.gif" alt="" style="height:1px;" width="0" border="0"><a href="http://example.com:20213/testweb1.2/testapp?WSDL">?HELLO</a></td>
<td id="link4"><img src="images/spacer.gif" alt="" style="height:1px;" width="0" border="0"><a href="http://example.com:20213/testweb1.2/testapp?WSDL" target="testwindow">?WSDL</a></td>
【问题讨论】:
标签: python html beautifulsoup html-parsing string-parsing