手机
当前位置:查字典教程网 >脚本专栏 >python >python使用BeautifulSoup分页网页中超链接的方法
python使用BeautifulSoup分页网页中超链接的方法
摘要:本文实例讲述了python使用BeautifulSoup分页网页中超链接的方法。分享给大家供大家参考。具体如下:python通过Beauti...

本文实例讲述了python使用BeautifulSoup分页网页中超链接的方法。分享给大家供大家参考。具体如下:

python通过BeautifulSoup分页网页中的超级链接,这段python代码输出www.jb51.net主页上所有包含了jb51的url链接

from BeautifulSoup import BeautifulSoup import urllib2 import re url = urllib2.urlopen("http://www.jb51.net") 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程序设计有所帮助。

【python使用BeautifulSoup分页网页中超链接的方法】相关文章:

在python的WEB框架Flask中使用多个配置文件的解决方法

python爬取网站数据保存使用的方法

python实现网页链接提取的方法分享

python中文乱码的解决方法

python中使用urllib2伪造HTTP报头的2个方法

下载给定网页上图片的方法

python批量下载图片的三种方法

Python中使用动态变量名的方法

Python中使用中文的方法

python抓取网页中的图片示例

精品推荐
分类导航