Answer the question
In order to leave comments, you need to log in
BeautifulSoup - problem extracting numbers with comma?
Example: you need to parse the price of 39.90, but the output is 39. Cuts off everything after the decimal point.
from bs4 import BeautifulSoup
import requests
def parse():
URL = 'https://1ak.by/shop/masla/motornye-masla/dlya-legkovyh-avtomobilej/gazpromneft-super-5w-40.html'
HEADERS = {
'Accept': '*/*',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0'
}
response = requests.get(URL, headers=HEADERS)
soup = BeautifulSoup(response.content, 'html.parser')
item = soup.find('div', class_='page-product__basket__total').find('b', class_='js-ch-cart-total').get_text(strip=True)
print(item)
parse()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question