[Tutor] Passing a variable to 'import'

Andy W toodles@yifan.net
Thu, 20 Dec 2001 13:51:16 +0800


Hi Christ

> So how do I, for example, grab a module name from sys.argv and then pass
it
> to the import command as a variable?
>
> - Chris

You'll want to look at the "imp" module.

http://www.python.org/doc/current/lib/module-imp.html

Also, take a look at the example for the imp module.

http://www.python.org/doc/current/lib/examples-imp.html

HTH,
Andrew

>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>