Steven Bethard wrote:
Tian wrote:

import ModuleA

classname = "Dog"
module = globals()["ModuleA"]
classobj = ???????           <---using classname
instanct = classobj()


classobj = getattr(module, classname)

There may not be any need for the indirect lookup of ModuleA, you can say classobj = getattr(ModuleA, classname)

Kent
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to