【发布时间】:2011-10-02 08:49:20
【问题描述】:
Calling a function of a module from a string with the function's name in Python 向我们展示了如何使用 getattr("bar")() 调用函数,但这假设我们已经导入了模块 foo。
假设我们可能还必须执行 foo 的导入(或从 bar 进口 foo)?
【问题讨论】:
-
类似的东西:stackoverflow.com/q/6509967 ?
-
感谢您的回复,我仍在审核回复是否符合我的预期目标。
标签: python