Apr-23-2022, 06:50 PM
Use Code Tag.
This look like homework?
I can give example how to start,then you have to try stuff yourself to solve the task.
This look like homework?
I can give example how to start,then you have to try stuff yourself to solve the task.
import requests from bs4 import BeautifulSoup url = 'https://www.laugfssuper.com/index.php/coconut-105320.html' response = requests.get(url) soup = BeautifulSoup(response.content, 'lxml') price = soup.find('div', class_="product-type-data")Test.
>>> price <div class="product-type-data"><div class="price-box"> <span class="regular-price" id="product-price-105320"> <span class="price">Rs.95.00</span> </span></div><p class="availability out-of-stock">Availability: <span>Out of stock</span></p></div> >>> price.text.strip() 'Rs.95.00 Availability: Out of stock'