I'm using API "chess.com" and I try to learn better dict:
{'url': 'https://www.chess.com/live/game/8554438187', 'pgn': '[Event "Live Chess"]\n[Site "Chess.com"]\n[Date "2021.03.03"]\n[Round "-"]\n[White "AHMEDAHMED1984"]\n[Black "pgmendormi"]\n[Result "0-1"]
i need url so i did:
data = get_player_game_archives(username).json
url = data['archives'][-1]
games = requests.get(url).json()
game = games['games'][-1]
print(games['games'][-1]['url'])
but how can I get "[Result "0-1"]"
I tried:
print(games['games'][-1]['url'][1])
but it gives me only one character, do I have to do a loop?
And how?
Thanks for your answers :)
.json()indata = ...seems to suggest that you're getting json data. Maybejson.loads(...)will be useful in this case?