Getting a class from its name

j vickroy jim.vickroy at
Tue Aug 20 17:42:01 EDT 2002

How about the eval() function?  For example,

>>> a = str('hi')
>>> a
>>> b = eval("str('hi')")
>>> b
>>> type(b)
<type 'str'>

"Henrik Motakef" <henrik.motakef at> wrote in message
news:8765y51azj.fsf at
> Hi,
> I guess thats an easy one, but somehow I'm blocked.
> How do I get a class given its name (or an object of this class
> ultimatly)?
> Say I have the string "xml.dom.Node", how do I use it to make a Node
> object?
> tia
> Henrik

More information about the Python-list mailing list