Reputation: 51
I am trying to retrieve the price from the URl mentioned in the code.
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>
I need just the price which is Rs.1,249 Can someone say what needs to be done? Thank you
Upvotes: 0
Views: 3435
Reputation: 12613
Simply user .get_text()
>>> price = soup.find("font",{"class":"items_price"})
>>> print(price.get_text())
'Rs.1,249'
Upvotes: 0