Python 如何使用bs4查找特定的div标记

Python 如何使用bs4查找特定的div标记,python,parsing,web-scraping,beautifulsoup,Python,Parsing,Web Scraping,Beautifulsoup,我正在尝试解析html文本并查找所有“”标记 当我运行此代码时,它会打印一个空列表 下面是我试图分离的html的一个片段 <div class="topclick-list-element-game-merchant"> CDKeys.com <div class="platform platform-pc&quo

我正在尝试解析html文本并查找所有“”标记

当我运行此代码时,它会打印一个空列表

下面是我试图分离的html的一个片段

        <div class="topclick-list-element-game-merchant">
            CDKeys.com
                                                <div class="platform platform-pc" title="pc"></div>
                                                                <div class="platform platform-xbox" title="xbox"></div>
                                    </div>
    </div>
    <span class="topclick-list-element-price">$11.19</span>
 </a>
                                                                                                 <a href="https://cheapdigitaldownload.com/nier-replicant-ver-1-22474487139-digital-download-price-comparison/" title="NieR Replicant ver.1.22474487139 cd key best prices" class="topclick-list-element ">
    <div class="topclick__image tpsprite11 tpsprite11-82-buy-nier-replicant-ver-1-22474487139-cd-key-pc-download-catalog-0" data-tp="tpsprite11"></div>
    <div class="topclick-list-element-game">
        <div class="topclick-list-element-game-title">NieR Replicant ver.1.22474487139</div>
        <div class="topclick-list-element-game-merchant">

CDKeys.com
$11.19
NieR复制版本1.22474487139

您错放了一个报价

div = bs4.find_all('div', class="topclick-list-element-game-merchant")
要使用
class=“topclick list element game merchant”
查找所有
,您可以使用以下示例:

从bs4导入美化组
html_doc=“”
CDKeys.com
$11.19
NieR复制版本1.22474487139
"""
soup=BeautifulSoup(html\u doc,“html.parser”)
对于汤中的div.find_all(class=“topclick list element game merchant”):
打印(div.get_text(strip=True))
印刷品:

CDKeys.com

这是否回答了您的问题?这给了我这个错误:
div=bs4.find_all('div',class=“topclick list element game merchant”)
SyntaxError:无效语法
div = bs4.find_all('div', class="topclick-list-element-game-merchant")