【发布时间】:2017-08-12 15:12:39
【问题描述】:
我是编程新手,所以我很可能做我想做的事情的想法完全不是这样做的方法。
我正在尝试从该站点上抓取排名表 - http://www.flashscore.com/hockey/finland/liiga/ - 现在如果我什至可以抓取带有团队名称的一列就可以了,所以我尝试找到带有“participant_name col_participant_name col_name”类的 td 标签" 但代码返回空括号:
import requests
from bs4 import BeautifulSoup
import lxml
def table(url):
teams = []
source = requests.get(url).content
soup = BeautifulSoup(source, "lxml")
for td in soup.find_all("td"):
team = td.find_all("participant_name col_participant_name col_name")
teams.append(team)
print(teams)
table("http://www.flashscore.com/hockey/finland/liiga/")
我尝试使用 tr 标签检索整行,但也没有成功。
【问题讨论】:
标签: python web-scraping beautifulsoup