beautifulsoup 4来了,支持python3.x
2012-02-08 01:51
405 查看
下载地址:
本月3日才更新,第一时间放出!
http://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/
记住:使用时候应该使用
初始化:
找所有class属性是sister的:
找所有id为link3的。
查找所有超连接的内容和地址
本月3日才更新,第一时间放出!
http://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/
记住:使用时候应该使用
from bs4 import BeautifulSoup
初始化:
from bs4 import BeautifulSoup as bs res=ur.urlopen('http://www.hao123.com').read() soup=bs(res)
找所有class属性是sister的:
for link in soup.findAll(attrs={'class':'sister'}): print(link.get('id'))
找所有id为link3的。
for link in soup.findAll(id='link3'): print (link)
查找所有超连接的内容和地址
for link in soup.find_all('a'): print(link.text,link.get('href'))
相关文章推荐
- ubuntu14.04 下让vim8.0开启python2.x 和 python3.x支持
- Python3.x中beautifulsoup的使用注意事项
- python 3.x 爬虫基础---Requersts,BeautifulSoup4(bs4)
- vim 7.4同时支持python 2.x和3.x问题调研
- 在Python 2.7即将停止支持时,我们为你准备了一份3.x迁移指南
- 64位Windows下安装xgboost详细参考指南(支持Python2.x和3.x)
- Python 3.x 安装 BeautifulSoup4 最佳实践
- python3.X下面安装BeautifulSoup
- python 3.x 不再支持MySQLdb 模块
- 在Python 2.7即将停止支持时,我们为你带来了一份python 3.x迁移指南
- 大家好,我的博客都转移到了http://www.pythonscientists.com/上面,希望大家能都多多支持
- python3.x如何从互联网获取想要的文章,及转化为nltk可以处理的文本
- 【转帖】windows下使用gvim搭建简单的IDE编译环境(支持C/C++/Python等)
- python3.X 与其他语言小不同
- CentOS下安装Python3后BeautifulSoup 版本不兼容问题解决方法
- [数据库测试]强烈推荐一个python ODBC数据源插件,可支持Oracle,Db2,Mysql,Sql-server以及各种数据库版本,附例子和测试程序
- Python爬虫入门(三)BeautifulSoup库
- Python3.x与Pyhon2.x的区别
- Python爬虫(2)--BeautifulSoup的使用
- python-001 第一个Python3.x程序 hello world