python网络爬虫
1、
from urllib.request import urlopen html = urlopen("http://pythonscraping.com/pages/page1.html") print(html.read())
2、安装beautifulsoup:pip install beautifulsoup4
3、
from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://pythonscraping.com/pages/page1.html") bs = BeautifulSoup(html.read()) print(bs.h1)#读取h1这一行
浙公网安备 33010602011771号