import requests
from bs4 import BeautifulSoup
#网址
url = 'http://etrlk.com'
response = requests.get(url)
#解析网页
soup = BeautifulSoup(response.text, 'html.parser')
#找到具体位置
data_list = soup.find_all(name='div',attrs={'class':'infoma'})
for data in data_list:
a_name = data.find(name = 'span',class_ = 'title').text
a_score = data.find(name = 'span',class_='rating_num').text
print(a_name+" ———— "+a_score)
python爬取,得到网页html.text,逐级解析html元素xxx,整合分析数据