python + urllib + BeautifulSoup 获取百度首页logo
1、urllib库是python自带的库,不需要安装。
2、BeautifulSoup是第三方库,安装方法: pip install bs4
# coding = utf-8
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup
# 请求获取html
html = urlopen('http://www.baidu.com/')
# BeautifulSoup解析html
obj = BeautifulSoup(html.read(<