【问题标题】:find specific row in table with soup.find_all pythonm使用soup.find_all python在表中查找特定行
【发布时间】:2020-06-15 03:45:28
【问题描述】:

我想从表中获取特定的字符串,所以:

soup.findAll("td", {"class": "spec-value"})

结果是:

All In One                            </td>, <td class="spec-value">
Asus                            </td>, <td class="spec-value">
All in one Z272SDT                            </td>, <td class="spec-value">
27''                            </td>, <td class="spec-value">
UHD 3840X2160                            </td>, <td class="spec-value">

但我只想获得第三个字符串(All in one Z272SDT)

怎么做?

【问题讨论】:

    标签: python-3.x web-scraping beautifulsoup web-crawler findall


    【解决方案1】:

    试试这个

    soup.findAll("td", {"class": "spec-value"})[2].text
    

    【讨论】:

    • 你是最棒的 :)
    猜你喜欢
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 2015-12-02
    • 1970-01-01
    • 1970-01-01
    • 2012-12-20
    • 2021-02-09
    • 2012-10-21
    相关资源
    最近更新 更多