[Wolves] python module query

Stuart Langridge sil at kryogenix.org
Mon Sep 6 18:15:22 BST 2004


sparkes wrote:
> exec 'import ' + <variable> + ' as my_mod'

Eek. Don't do that.

foo = __import__('foo')

Much neater. The exec() function is an evil sin. Any time you think of 
using it, there's likely to be a better way :)

Aq.



More information about the Wolves mailing list