I would like to know why
>>> def func2():
... global time
... import time
...
>>> time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'time' is not defined
>>> func2()
>>> time
<module 'time' (built-in)>
>>>
works, but
>>> def func():
... global module
... module="time"
... exec ("global %s" %module)
... exec ("import %s" %module)
...
>>> time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'time' is not defined
>>> func()
>>> time
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'time' is not defined
works not, and how i could get it to work =) thank you