从列表格式化为 python 中的函数

Fomatting from a list to a function in python

免责声明:初学者

我有如下货币对列表:

  pair_list = ["AUD/CAD","CAD/SEK","CHF/DKK"]

我正在尝试将每一对映射到如下函数:

AUD_CAD, metadata_AUD_CAD = fx.get_currency_exchange_daily(from_symbol='AUD',to_symbol='CAD', outputsize="full")

我已经尝试了一些解决方案来让它工作,但到目前为止没有成功,我知道解决方案很简单,但我还没有找到它。与此同时,有谁知道我将如何获得它?

result = {}
for pair in pair_list:
    (from, to) = pair.split('/')
    result[pair] = fx.get_currency_exchange_daily(from_symbol=from, to_symbol=to, outputsize="full")