如何引用同名的span类Python / Beautiful Soup

时间:2019-11-02 10:05:21

标签: python selenium

试图提取的Span类文本具有相同的名称。 -KambiBC-my-bets-summary__value

在下面的示例html中,我试图将以下属性提取到单独的列表中,这些列表可以由span类 before 来标识:KambiBC-my-bets-summary__value

面对面-包括加时赛:丹佛掘金

$ 95.00

1.61

尝试了以下方法,但没有成功

elm = soup.find('span',class _ =“ another class”)。find('span',class _ =“ test class”) 打印(elm.get_text())

               <div class="KambiBC-my-bets-summary__field KambiBC-my-bets-summary__field--bet-label"><span class="KambiBC-my-bets-summary__value">Head To Head - Including Overtime: Denver Nuggets</span></div>
                    <div class="KambiBC-my-bets-summary__field"><span class="KambiBC-my-bets-summary__label">Stake: </span><span class="KambiBC-my-bets-summary__value">$95.00 </span></div>
                    <div class="KambiBC-my-bets-summary__field"><span class="KambiBC-my-bets-summary__label">Odds: </span><span class="KambiBC-my-bets-summary__label KambiBC-my-bets-summary__old-value">1.58</span><span class="KambiBC-my-bets-summary__value">1.61</span></div>

0 个答案:

没有答案