dynamic includes from classes...

Mark McEahern marklists at mceahern.com
Thu Sep 12 13:42:22 EDT 2002


[mike]
> First, is there a better way than exec to dynamically include a module?
> i.e.
> importvar = "foo"
> exec("from %s import %s" % (importvar, importvar))

s = "sys"
sys = __import__(s)
print sys.path

// m
-





More information about the Python-list mailing list