您好,欢迎访问一九零五行业门户网

python使用BeautifulSoup分页网页中超链接的方法

本文实例讲述了python使用beautifulsoup分页网页中超链接的方法。分享给大家供大家参考。具体如下:
python通过beautifulsoup分页网页中的超级链接,这段python代码输出www.bitscn.com主页上所有包含了jb51的url链接
from beautifulsoup import beautifulsoupimport urllib2import reurl = urllib2.urlopen(http://www.bitscn.com)content = url.read()soup = beautifulsoup(content)for a in soup.findall('a',href=true): if re.findall('sharejs', a['href']): print found the url:, a['href']
希望本文所述对大家的python程序设计有所帮助。
其它类似信息

推荐信息