0
I am working on a project that I need to remove data from a Python list, but when I put the index I want, it comes out only the first letter, or the first character.
{"date":"2020-12-02","opening":99131.18,"closing":100614.99,"lowest":97500,"highest":101999.99,"volume":11373667.10536848,"quantity":113.46703469,"amount":5471,"avg_price":100237.63409735}
This is the output, I would like to remove the data, for example, take the date data and put in a variable.
response = requests.get(f'https://www.mercadobitcoin.net/api/BTC/day-summary/{year}/{month}/{day}/')
print(response.text[2]) #aqui sai somente a letra "d"
I believe the two questions suggested above in the blue box solve your problem: the first one tells you how to get the data (using
json()
instead oftext
), and the second has a good explanation on how to get the data from JSON– hkotsubo
This is a dictionary format { }, you can access the key and access the value you want l.
– stack.cardoso