【发布时间】:2013-02-25 03:13:03
【问题描述】:
是否可以只获取特定的 URL?
喜欢:
<a href="http://www.iwashere.com/washere.html">next</a>
<span class="class">...</span>
<a href="http://www.heelo.com/hello.html">next</a>
<span class="class">...</span>
<a href="http://www.iwashere.com/wasnot.html">next</a>
<span class="class">...</span>
输出应该只是来自http://www.iwashere.com/的网址
喜欢,输出网址:
http://www.iwashere.com/washere.html
http://www.iwashere.com/wasnot.html
我是通过字符串逻辑做到的。有没有直接使用 BeautifulSoup 的方法?
【问题讨论】:
标签: python python-2.7 web-scraping beautifulsoup