您的位置:首页 > 理论基础 > 计算机网络

Python网络爬虫 - 2. Beautiful Soup小试牛刀

2015-09-16 11:27 513 查看
目标:

我们解析百度首页的logo

bs_baidu_logo.py

from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://www.baidu.com")
bsObj = BeautifulSoup(html.read(), "html.parser")
print(bsObj.img)


运行结果:

<img height="129" hidefocus="true" src="//www.baidu.com/img/bd_logo1.png" width="270"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: