赞
踩
import requests from bs4 import BeautifulSoup res = requests.get(url="https://.aspx") # 网站输入自己需要爬取的网站 soup = BeautifulSoup(res.text,"html.parser") subject = soup.findAll(attrs={"class":"field ui-field-contain"}) for sub in subject: question=sub.find(attrs={"class":"field-label"}) answer = sub.findAll(attrs={"class":"label"}) print(question.text) for an in answer: print(an.text) print()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。