【发布时间】:2021-07-17 03:22:25
【问题描述】:
我目前正在尝试解析来自特定网页的文本,到目前为止效果很好。我只是在努力“让”文本进一步使用它。
到目前为止,我的代码如下所示:
basename (URL which will be scraped in general)
request_two = requests.get("https://www.billiger.de/shops?shopsearch=" + basename)
def find_tags_from_class(html):
soup = BeautifulSoup(html.content, "html.parser")
div = soup.find("div", class_="svg-rating-stars large blue")
print(div)
这会打印出<div class="svg-rating-stars large blue" style="--rating: 100.0"></div>
或<div class="svg-rating-stars large blue" style="--rating: 98.3"></div>(取决于用户要检查的商店(基本名称))
由于这可能会有所不同,我想检查在“svg-rating-stars large blue”类中解析的评分是否大于或等于 80。有可能这样做吗?我对 python 和 webscraping 还很陌生,现在找不到任何解决方案。
【问题讨论】:
标签: python html css web-scraping