hi i am using api in my code that outputs in json format and it looks like this
{"rates":{"CZK":25.738},"base":"EUR","date":"2021-02-09"}
i want only the CZK part so 25.738 as output
i had tried this
def get_kurz():
res = requests.get('https://api.exchangeratesapi.io/latest?symbols=CZK')
kurz = json.loads(res.text)
result = (kurz['CZK'])
return(result)
but that didnt work closest i could get it to work was
def get_kurz():
res = requests.get('https://api.exchangeratesapi.io/latest?symbols=CZK')
kurz = json.loads(res.text)
result = (kurz['rates'])
return(result)
and that outputs
{'CZK': 25.738}