我正在尝试使用名为“lead-value”的类访问 div 中的值。这是第二次出现带有值为“lead-value”的类的 div,因此我试图通过在第二个“lead-value”出现的父项下设置子集来访问此特定实例。
这是html:
<td title="College Readiness is based on the percentages of 12th graders who were tested and passed AP® exams. The maximum college readiness index value is 100.0." class="column-last column-even table-column-last table-column-even g_school_in_country_college_readiness_index_stacked cluetip">
<div>
<p><div class="lead-value">100.0</div>
所以我想使用怪物类名"column-last column-even table-column-last table-column-even g_school_in_country_college_readiness_index_stacked cluetip"
来获取值'100'。
我将如何使用 BeautifulSoup 做到这一点?