> module_name = "module"
> mod = __import__(module_name)
> class_name = module_name.capitalize()
> cls = getattr(mod, class_name)
> inst = cls()
>
Worked like a magic charm :) Also helped me understand the concept of getattr :D
Thanks a million!
--
warm regards,
Pradnyesh Sawant
--
Be yourself.
On Mon, 2007-04-09 at 22:52 +0530, Pradnyesh Sawant wrote:
> Hello,
> I have a string which in reality is the name of a module to be
> imported. The name of the class contained in the module also has the
> same (although with different capitalization). My requirement is to
> import the module, and