To get all property of a class?

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sun Jun 29 19:15:47 EDT 2003


manuel wrote:
> Exist a sintax like
> 
> import Foo
> for property in Foo
>     print property

Yes, use __dict__, it contains the mapping of all attributes
of an object (module, class, whatever) to their values:

import os
for (name,value) in os.__dict__:
	print name,"=",value


--Irmen





More information about the Python-list mailing list