python 解析html
2020-02-20 本文已影响0人
misspass
import urllib2
from bs4 import BeautifulSoup #这里需要导入BeautifulSoup
url="http://www.baidu.com"
content=urllib2.urlopen(url)
soup=BeautifulSoup(content) #将网页内容转化为BeautifulSoup 格式的数据
print soup
import urllib2
from bs4 import BeautifulSoup #这里需要导入BeautifulSoup
url="http://www.baidu.com"
content=urllib2.urlopen(url)
soup=BeautifulSoup(content) #将网页内容转化为BeautifulSoup 格式的数据
print soup