Find class of an instance?

Heiko Wundram modelnine at modelnine.org
Wed Aug 6 08:54:13 EDT 2008


Am Mittwoch, den 06.08.2008, 08:44 -0400 schrieb Neal Becker:
> Sounds simple, but how, given an instance, do I find the class?

<inst>.__class__

For example:

Python 2.5.2 (r252:60911, Aug  5 2008, 03:26:50)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = "hello"
>>> x.__class__
<type 'str'>
>>>

--- Heiko.




More information about the Python-list mailing list