import requests from bs4 import BeautifulSoup url = 'http://pm25.in/'+city_pinyin r = requests.get(url, timeout=30) soup = BeautifulSoup(r.text, 'lxml') div_list = soup.find_all('div', {"class":"span1"})
BeautifulSoup的使用示例,供参考
import requests from bs4 import BeautifulSoup url = 'http://pm25.in/'+city_pinyin r = requests.get(url, timeout=30) soup = BeautifulSoup(r.text, 'lxml') div_list = soup.find_all('div', {"class":"span1"})
BeautifulSoup的使用示例,供参考