import with variable
Marcio Rosa da Silva
mrs at myrealbox.com
Mon Mar 17 08:29:29 EST 2003
Rene Pijlman wrote:
> Marcio R. da Silva:
>
>>I'm trying to import a file using the name stored in a variable. For example:
>>
>> r = "module"
>> import r
>>
>>I know this didn't work, but I would like to know how I can do this. I
>>need to create a module "on the fly" and use it in my program.
>
>
> See __import__ on
> http://www.python.org/doc/current/lib/built-in-funcs.html
>
Thanks! That's exactly what I need!
Marcio
More information about the Python-list
mailing list