【发布时间】:2022-01-25 11:02:12
【问题描述】:
我正在抓取产品信息。但是我刮掉了它的价格,它没有给我适当的输出。没有错误但不是所需的输出。
而且在查找产品类别时也会产生错误。 这是我的代码。
import requests
from bs4 import BeautifulSoup as bs
import pandas
url='https://shop.eziline.com/product/uncategorized/umrah-management-system/'
r=requests.get(url)
soup=bs(r.content,'html.parser')
name=soup.find(class_='product_title entry-title').text.strip()
print(name)
price=soup.find('span',class_='woocommerce-Price-amount amount').text.strip()
print(price)
detail=soup.find(class_='woo-product-details_short-description').text.strip()
print(detail)
category=soup.find('cats-link a').text.strip()
print(category)
【问题讨论】:
-
它给了我输出 R.s 0.00
标签: python beautifulsoup jupyter scrape