Does anyone know what is the equivalent of
from modulename import var
if I wanted to use import_module
The following works
_tmep = importlib.import_module(modulename)
var = _temp.var
Or in one line as:
var = importlib.import_module(modulename).var
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.