好的,对你们中的一些人来说应该是一个简单的问题,但我找不到任何解决我这个问题的方法。我想从NHL.com上搜一张桌子,但找不到——我试过“桌子”、“反应桌”之类的
import pandas as pd
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
from pandas_profiling import ProfileReport
import numpy as np
import matplotlib as plt
url = "http://www.nhl.com/stats/teams?report=goalsbyperiod&reportType=game&dateFrom=2020-03-11&dateTo=2020-09-11&gameType=3&filter=gamesPlayed,gte,1&sort=period1GoalsFor&page=0&pageSize=50"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
result = soup.find_all('table')
df_raw = pd.read_html(str(table))[0]
它只显示ValueError:未找到任何表
我使用的大多数网站都使用相同的代码。请帮忙
页面上的数据在
div
内,而不是table
内。您可以使用selenium
进行以下操作:输出:
相关问题 更多 >
编程相关推荐