Python BeautifulSoup解析问题某些div未显示

Python BeautifulSoup解析问题某些div未显示,python,html,parsing,beautifulsoup,Python,Html,Parsing,Beautifulsoup,我正在尝试分析此页面: 问题是,在这个元素中:, 我想要包含价格的div。如果查看页面,可以看到此部分的html代码,如下所示: <div class="price"> <div class"price"> "thePrice" <sup>93</sup> </div> </div> 就这样。我在互联网上搜索了几个小时,想弄明白为什么内部d

我正在尝试分析此页面:

问题是,在这个元素中:, 我想要包含价格的div。如果查看页面,可以看到此部分的html代码,如下所示:

<div class="price">
  <div class"price">
    "thePrice"
    <sup>93</sup>
  </div>
</div>
就这样。我在互联网上搜索了几个小时,想弄明白为什么内部div没有被解析

三个不同的解析器,似乎没有一个能够传递这样一个事实:内部子级与其父级共享相同的类名,如果这是问题的话

谢谢你的帮助

祝你过得愉快

马克西姆希望它能帮助你

from bs4 import BeautifulSoup
import requests

url = 'https://www.ldlc.com/fr-be/informatique/pieces-informatique/carte-professionnelle/c4685/'
html = BeautifulSoup(requests.get(url).content, 'html.parser')
prices = html.find_all("div", {"class": "price"})
for price in prices:
    print(price.text)
打印输出

561€95 
 169€94 
 165€95 
 1 165€94 
 7 599€95 
 267€95 
 259€94 
 599€95 
 511€94 
 1 042€94 
 2 572€94 
 783€95 
 2 479€94 
 2 699€95 
 499€94 
 386€95 
 169€94 
 2 343€95 
 783€95 
 499€94 
 499€94 
 259€94 
 267€95 
 165€95 
 169€94 
 2 399€95 
 561€95 
 2 699€95 
 2 699€95 
 6 059€95 
 7 589€95 
 10 991€95 
 9 619€94 
 2 479€94 
 3 135€95 
 7 589€95 
 511€94 
 1 042€94 
 386€95 
 599€95 
 1 165€94 
 2 572€94 
 783€95 
 2 479€94 
 2 699€95 
 499€94 
 169€94 
 2 343€95 
 2 699€95 
 3 135€95 
 6 816€95 
 7 589€95 
 561€95 
 267€95 

要清除
class=“price”>
中的所有价格,请参见此示例:

import requests
from bs4 import BeautifulSoup


url = 'https://www.ldlc.com/fr-be/informatique/pieces-informatique/carte-professionnelle/c4685/'
soup = BeautifulSoup(requests.get(url).content, 'html.parser')
# Select all the 'price' classes
for tag in soup.select('div.price'):
    print(tag.text)
import requests
from bs4 import BeautifulSoup


url = 'https://www.ldlc.com/fr-be/informatique/pieces-informatique/carte-professionnelle/c4685/'
soup = BeautifulSoup(requests.get(url).content, 'html.parser')
# Select all the 'price' classes
for tag in soup.select('div.price'):
    print(tag.text)