[Tutor] Passing a variable to 'import'

Andy W toodles@yifan.net
Thu, 20 Dec 2001 14:00:07 +0800


> Hi Christ

Oh dear, that's got to be the best typo I've ever done.

>
> > 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
> >
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>