gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 01:08:33 25 4
gpt4 key购买 nike

我刚刚创建了第一个教程文件,用于从网页上抓取价格。我做了以下事情

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)

为什么我得到的价格是问题 54,95?

正常吗?

最佳答案

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

关于python - 为什么当我从网页上抓取价格时,我会得到一个 ?用 python ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55092945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com