1 回答

TA貢獻(xiàn)1793條經(jīng)驗(yàn) 獲得超6個(gè)贊
嘗試這個(gè):
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']}")
這為您提供了(這只是一個(gè)示例,您可以獲得任何您想要的字段):
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 中“導(dǎo)航”遇到困難,只需將響應(yīng)內(nèi)容復(fù)制到在線JSON 格式化程序中,單擊wrench
圖標(biāo)即可修復(fù)它,然后單擊Format / Beautify
。
添加回答
舉報(bào)