On Wed, 21 Nov 2007 18:55:21 -0800, Davy wrote:

> Hi all,
> 
> How to get the class name of an object from an introspect way? For
> example,
> Class cls:pass
> 
> obj = cls()
> 
> I want to get function(obj) = 'cls'


obj.__class__ returns the class itself.

obj.__class__.__name__ returns the name of the class as a string.





-- 
Steven.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to