You are correct.

On 7 August 2012 14:38, Chris Angelico <ros...@gmail.com> wrote:

> On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N <gelon...@gmail.com> wrote:
> > modulename = 'my.module'
> > cmd = 'import %s as amodule'
> > try:
> >     exec(cmd)
> >     print "imported successfully"
>
> Someone will doubtless correct me if I'm wrong, but I think you can
> avoid exec here with:
>
> amodule=__import__(modulename)
>
> ChrisA
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to