标签:
目标:
我们解析百度首页的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"/>
Python网络爬虫 - 2. Beautiful Soup小试牛刀
标签:
原文地址:http://www.cnblogs.com/davidgu/p/4812765.html