【发布时间】:2016-09-01 11:21:19
【问题描述】:
我正在尝试从代码中提到的 URl 中检索价格。
import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.forever21.com/IN/Product/Product.aspx?
BR=LOVE21&Category=whatsnew_app&ProductID=2000054242&VariantID=")
soup = BeautifulSoup(r.content, 'html.parser')
#print(soup.prettify())
price = soup.find_all("font",{"class":"items_price"})
print(price)
#Output:
<font class="items_price">Rs.1,249</font>
我只需要 1,249 卢比的价格 有人可以说需要做什么吗? 谢谢
【问题讨论】:
-
你只需要
soup.find("font",{"class":"items_price"}).text
标签: python beautifulsoup