📅  最后修改于: 2022-03-11 14:45:41.339000             🧑  作者: Mango
import requests
APP_ID = "**********************"
ENDPOINT = "https://openxchangerates.org/latest.json"
response = requests.get(f"{ENDPOINT}?app_id={APP:ID}")
exchange_rate = response.json()["rates"]
usd_amount = 1000
gbp_amount = usd_amount * exchange_rate["GBP"]
print(f"USD{usd_amount} is GBP{gbp_amount}")