使用 soup.find_all python 在 table 中查找特定行
find specific row in table with soup.find_all pythonm
我想从 table 中获取特定的字符串,所以:
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">
但我只想得到第三根弦(多合一 Z272SDT)
怎么做?
试试这个
soup.findAll("td", {"class": "spec-value"})[2].text
我想从 table 中获取特定的字符串,所以:
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">
但我只想得到第三根弦(多合一 Z272SDT)
怎么做?
试试这个
soup.findAll("td", {"class": "spec-value"})[2].text