Claudio Grondi wrote:
"Steven Reddie" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
I want to do something like the following, which doesn't work:
modulename = 'module'
import modulename
The error is that there is no module named 'modulename'. Is there a
way to get that variable expanded?
modulename = 'module'
cmd = 'import '+modulename
exec(cmd)
Check also the thread:
How do I import everything in a subdir?
in THIS newsgroup.
And note that it tells you to use __import__, not exec. =)
STeVe
--
http://mail.python.org/mailman/listinfo/python-list