Re: doubt with importing module, given module name

2007-04-13 Thread Pradnyesh Sawant
> 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.

Re: doubt with importing module, given module name

2007-04-09 Thread Carsten Haese
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

doubt with importing module, given module name

2007-04-09 Thread Pradnyesh Sawant
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 also create an instance of the class. eg: str = "module"