Python soup.find不会返回任何内容

Python soup.find不会返回任何内容,python,beautifulsoup,Python,Beautifulsoup,我想从亚马逊网页上获取一些信息。我已经写了这几行基本的文字,但它们不起作用 导入请求 从bs4导入BeautifulSoup url='1〕https://www.amazon.com/Cooler-Master-SickleFlow-120-Radiators/dp/B0046U6DWO/ref=sr_1_3?keywords=green+外壳+风扇和qid=1578069342和sr=8-3' headers={User-Agent:'Mozilla/5.0windowsnt10.0;Win

我想从亚马逊网页上获取一些信息。我已经写了这几行基本的文字,但它们不起作用

导入请求 从bs4导入BeautifulSoup url='1〕https://www.amazon.com/Cooler-Master-SickleFlow-120-Radiators/dp/B0046U6DWO/ref=sr_1_3?keywords=green+外壳+风扇和qid=1578069342和sr=8-3' headers={User-Agent:'Mozilla/5.0windowsnt10.0;Win64;x64 AppleWebKit/537.36 KHTML,如geckocrome/79.0.3945.88 Safari/537.36'} page=requests.geturl,headers=headers soup=beautifulsoupage.content,“html.parser” 价格=汤。findid='priceblock\u ourprice' 印刷价格
您的代码没有问题,但是html.parser解析页面内容的能力很差。改用html5lib或lxml:

印刷品:

<span class="a-size-medium a-color-price priceBlockBuyingPriceString" id="priceblock_ourprice">$10.50</span>
<span class="a-size-medium a-color-price priceBlockBuyingPriceString" id="priceblock_ourprice">$10.50</span>