why this error?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Dec 17 05:54:49 EST 2007


En Mon, 17 Dec 2007 02:45:34 -0300, python.jiang <python.jiang at 163.com>  
escribi�:

> thanks all first. but i had one class bellow to get object info what  
> user had inputed when run application. because the problem that i had  
> showed yestoday, i must write the code so hard to understand.
> can any friend tell me one way to solve this problem?
> thanks!!

You can import a module using __import__, and from the returned module  
object obtain all the info you want using getattr.
Don't use eval - write your code as if such function didn't exist.
And don't use global variables either - you have defined a class, use its  
attributes and methods!

-- 
Gabriel Genellina




More information about the Python-list mailing list