通过本文主要向大家介绍了python beautifulsoup,python beautiful,beautiful4包python,beautifulsoup,beautifulsoup安装等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了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']
</div>
希望本文所述对大家的Python程序设计有所帮助。
</div>您可能想查找下面的文章:
- Python利用Beautiful Soup模块创建对象详解
- Python利用Beautiful Soup模块修改内容方法示例
- Python利用Beautiful Soup模块搜索内容详解
- Python利用Beautiful Soup模块创建对象详解
- Python利用Beautiful Soup模块修改内容方法示例
- Python使用BeautifulSoup库解析HTML基本使用教程
- python基于BeautifulSoup实现抓取网页指定内容的方法
- Python中使用Beautiful Soup库的超详细教程
- Python中使用Beautiful Soup库的超详细教程
- python使用BeautifulSoup分页网页中超链接的方法

