早上好,当我想从div抓取数据时,我没有什么问题。例如,我在网站上有一个结构,如:
<div class="score-result">
Player1Name
Player1Surname
<div>score</div>
</div>
我想知道球员的名字、姓氏和分数。我写过这样的smth,但它不打印任何东西
def trade_spider(max_hall,max_period):
hall=2
period=1
while hall <= max_hall:
url ='https://tabletennis.setkacup.com/en/schedule?date=2021-08-27&hall=' +str(hall)+'&'+'period='+str(period)
source_code = requests.get(url)
plain_text=source_code.text
soup=BeautifulSoup(plain_text, "html.parser")
for link in soup.findAll('table', {'class': 'score-result'}):
score = link.get('score-result')
print(score)
hall=+1
period=+1
请检查您这边的代码
希望能对您有所帮助
相关问题 更多 >
编程相关推荐