有谁知道为什么我的列表索引超出此代码的范围? len()是380,但在10之后停止打印。谢谢
from urllib.request import urlopen
from urllib.error import HTTPError
from urllib.error import URLError
import json
team_id = ['ARS','BOU','BHA','BUR','CHE','CRY','EVE','HUD','LEI','LIV','MCI','MUN','NEW','SOU','STK','SWA','TOT','WAT','WBA','WHU']
i=0
while i <= len(fixture)-1:
try:
htmlfixture = urlopen("https://fantasy.premierleague.com/drf/fixtures/" + str(i)).read()
fixture = json.loads(htmlfixture)
except HTTPError as e:
print(e)
except URLError as e:
print("the server could not be found!")
else:
print(fixture[i])
print(type(fixture))
fixture = fixture[i]
id = fixture['id']
team_a = team_id[fixture['team_a']]
print(team_a)
team_h = team_id[fixture['team_h']]
print(team_h)
i = i+1