我刚刚创建了我的第一个教程文件,用于从网页上搜索价格。我做了以下
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?
这是正常的吗?
我刚刚将终端的字体改为lucida ..并显示欧元符号..谢谢!