import cfbd # API for accessing all sorts of college football data.
team_player_stats = cfbd.PlayersApi.get_player_season_stats(self=[], year=2019, team="Georgia", category="passing")
print(team_player_stats)它说self没有定义,但我不确定self是什么。
发布于 2020-08-16 06:58:48
您熟悉如何使用Python类和方法吗?
如果您按照文档here操作,它将向您展示如何实例化PlayersApi和使用get_player_season_stats方法
# create an instance of the API class
api_instance = cfbd.PlayersApi()
year = 56 # int | Year filter
team = 'team_example' # str | Team filter (optional)
conference = 'conference_example' # str | Conference abbreviation filter (optional)
start_week = 56 # int | Start week filter (optional)
end_week = 56 # int | Start week filter (optional)
season_type = 'season_type_example' # str | Season type filter (regular, postseason, or both) (optional)
category = 'category_example' # str | Stat category filter (e.g. passing) (optional)
try:
# Player stats by season
api_response = api_instance.get_player_season_stats(year, team=team, conference=conference, start_week=start_week, end_week=end_week, season_type=season_type, category=category)
print(api_response)
except ApiException as e:
print("Exception when calling PlayersApi->get_player_season_stats: %s\n" % e)发布于 2020-08-16 06:59:25
Self用于类方法声明,作为一种初始值。在这种情况下,您试图在对象本身上声明一个空列表。
尝试删除声明。自我并不是用来拥有某种价值的。
干杯
https://stackoverflow.com/questions/63431472
复制相似问题