- 论坛徽章:
- 0
|
__import__的问题。
应该这样:
import functools
modules = map(functools.partial(__import__, fromlist=[None,]), modules_names)
查看官方文档
https://docs.python.org/2/library/functions.html#__import__
__import__(name[, globals[, locals[, fromlist[, level]]]])
When the name variable is of the form package.module, normally, the top-level package (the name up till the first dot) is returned, not the module named by name.
However, when a non-empty fromlist argument is given, the module named by name is returned.
|
|