【发布时间】:2010-07-17 17:53:45
【问题描述】:
我正在使用 BeautifulSoup 来解析一些 html。内容如下:
<tr>
<th>Your provider:</th>
<td>
<img src="/isp_logos/la-la-la.ico" alt=""/>
<a href="/isp/SomeProvider">
Provider name </a>
<a href="http://*/isp-comparer/?isp=000000">
</a>
</td>
</tr>
我必须从链接中获取 SomeProvider 文本。我的代码是:
contentSoup = BeautifulSoup(ThatHtml)
print contentSoup.findAll('a', href=re.compile('/isp/(.*)'))
结果是空数组,为什么?也许还有其他方法?
【问题讨论】:
标签: python html regex beautifulsoup