To emulate from foo import *
you could use dir
to get the attributes of the imported module:
foo = __import__('foo')
for attr in dir(foo):
if not attr.startswith('_'):
globals()[attr] = getattr(foo, attr)
Using from foo import *
is generally frowned upon, and emulating it even more so, I'd imagine.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…