import with variable

Marcio R. da Silva mrs at myrealbox.com
Mon Mar 17 06:11:50 EST 2003


Hello!

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.

Thanks in advance!

Marcio




More information about the Python-list mailing list