3 ms·
import is a statement. __import__ is a function hence will work. In [1]: accio = __import__ In [2]: accio("os") Out[2]: <module 'os' from '/us
by daGrevis 13y ago
import is a statement. __import__ is a function hence will work.
In [1]: accio = __import__
In [2]: accio("os")
Out[2]: <module 'os' from '/usr/lib/python2.7/os.pyc'>
- raimondious 13y agoFrom the article... >>> accio = __builtins__.__import__ >>> accio sys File "<stdin>", line 1 accio sys ^ SyntaxError: invalid syntax # :( The author wanted accio to replace import not __import__.