为什么当我从网页上抓取价格时我会得到一个?用python?

问题描述 投票:1回答:1

我刚刚创建了我的第一个教程文件,用于从网页上搜索价格。我做了以下

import urllib.request
from bs4 import BeautifulSoup
from urllib import parse

url = 'https://www.wavemotion.gr/el/shop/smartphone-accessories/easy-one-touch-wireless-fast-charging-mount'
#download the URL and extract the content to the variable html 

request = urllib.request.Request(url)
html = urllib.request.urlopen(request).read()

#pass the HTML to Beautifulsoup.
soup = BeautifulSoup(html,'html.parser')

#get the HTML
main_table = soup.find("div",attrs={'class':'single-product__price'})

price = main_table.find('span',attrs={'class':'woocommerce-Price-amount amount'}).text

print(price)

为什么我把价格作为问题545?

这是正常的吗?

python web-scraping
1个回答
2
投票

我刚刚将终端的字体改为lucida ..并显示欧元符号..谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.