首页 > 解决方案 > python webscraping与BeautifulSoup问题

问题描述

我试图从https://www.nascar.com/stats/2021/1/box-score刮掉盒子得分表

如果有人可以看一下并指出我正确的方向,我的代码将无法正常工作。

`import requests
from bs4 import BeautifulSoup
import pandas as pd

import requests
from bs4 import BeautifulSoup
import pandas as pd

url = ('https://www.nascar.com/stats/2021/1/box-score')
response = requests.get(url, headers = headers)
response.content
soup = BeautifulSoup(response.content, 'html.parser')
stats = soup.find_all('table', class_ = "stats-box-score-table-driver")
stats
for row in stats.find_all('tr'):
    for cell in row.find_all('td'):
        print(cell.text)

标签: python-3.x

解决方案


推荐阅读