How to create an object instance from a string??

Do Re Mi chel La Si Do enleverlesO.OmcO at OmclaveauO.com
Sat Mar 19 18:00:09 EST 2005


Hi !


Also :


    classname = "Dog"
    exec("b="+classname+"()")
    b.bark()

or

    classname = "Dog"
    exec("cl="+classname)
    b=cl()
    b.bark()



Michel Claveau







More information about the Python-list mailing list