1 回答
TA贡献1793条经验 获得超6个赞
尝试这个:
import requests
url = "https://api.wtatennis.com/tennis/tournaments/?page=0&pageSize=100&excludeLevels=ITF&from=2020-09-01&to=2020-09-30"
response = requests.get(url).json()
for item in response["content"]:
print(f"{item['tournamentGroup']['name']} - {item['year']} - {item['title']}")
这为您提供了(这只是一个示例,您可以获得任何您想要的字段):
Prague 125K - 2020 - Prague Open
US OPEN - 2020 - US Open - New York, United States, NY
WARSAW - 2020 - BNP Paribas Warsaw Open - Warsaw, Poland
ISTANBUL - 2020 - TEB BNP Paribas Tennis Championship Istanbul - Istanbul, Turkey
MADRID - 2020 - Mutua Madrid Open - Madrid, Spain
HIROSHIMA - 2020 - Hana-cupid Japan Women's Open - Hiroshima, Japan
ROME - 2020 - Internazionali BNL d'Italia - Rome, Italy
STRASBOURG - 2020 - Internationaux de Strasbourg - Strasbourg, France
ROLAND GARROS - 2020 - Roland Garros - Paris, France
TASHKENT - 2020 - Tashkent Open - Tashkent, Uzbekistan
如果您在 JSON 中“导航”遇到困难,只需将响应内容复制到在线JSON 格式化程序中,单击wrench
图标即可修复它,然后单击Format / Beautify
。
添加回答
举报