A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/085021.html below:

how to import from variable source

how to import from variable source how to import from variable sourceAlex Martelli aleaxit at yahoo.com
Sun Apr 15 12:43:59 EDT 2001
"Martin Bless" <m.bless at gmx.de> wrote in message
news:3ad998f3.3543207 at news.muenster.de...
> >Use the __import__() builtin function:
> >
> > module = __import__('mymod')
>
> Is there a way to manipulate the resulting 'mymod.__name__'?

Not with __import__, I think.

> If - against normal behavior - it could be set to '__main__' the
> imported 'mymod' could be deceived leading to execution of code

You can do that with the imp.load_module() function.


Alex




More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4