How do I import everything in a subdir?

Steven Bethard steven.bethard at gmail.com
Mon Mar 7 07:48:53 CET 2005


YL wrote:
> Try something like this:
>     for x in plugs:
>         cmd = "import %s" % x
>         exec (cmd)

For the sake of others who might have missed the rest of this thread, 
I'll point out that this is definitely not the way to go.  No need to 
use exec when the builtin __import__ function is already defined for 
exactly this sort of use.

STeVe



More information about the Python-list mailing list