【发布时间】:2020-11-18 01:03:55
【问题描述】:
我是 Python 新手,目前正在使用 BeautifulSoup 和 Python 来尝试提取一些表数据。我无法将单个元素从 td 中取出。到目前为止我所拥有的是:
from bs4 import BeautifulSoup
import requests
source = requests.get('https://gol.gg/teams/list/season-ALL/split-ALL/region-ALL/tournament-LCS%20Summer%202020/week-ALL/').text
soup = BeautifulSoup(source, 'lxml')
td = soup.find_all('td', {'class': 'text-center'})
print(td)
这确实显示了我想要提取的所有 td,但我无法弄清楚如何从 td 中取出每个单独的元素。
非常感谢您的帮助,非常感谢。
【问题讨论】:
-
缺少什么?第一行第一列?
标签: python python-3.x beautifulsoup