Python-爬蟲-api-全球即時匯率API

全球即時匯率API

https://tw.rter.info/

https://tw.rter.info/howto_currencyapi.php

capi.py

import requests
r=requests.get('https://tw.rter.info/capi.php')
currency=r.json()
print(currency)

 

將資料整理後印出

import requests

r = requests.get('https://tw.rter.info/capi.php')
data = r.json()
#print(data)

# 輸出資料
for currency, info in data.items():
    #print(currency)#幣別 USDFKP
    #print(info) #匯率與更新時間{'Exrate': 0.784114, 'UTC': '2023-08-08 08:59:59'}
    exrate = info['Exrate']
    update_time = info['UTC']
    print(f"幣別: {currency}, 匯率: {exrate}, 更新時間: {update_time}")

 

參考

 

 

Yiru@Studio - 關於我 - 意如