How to find the name of your class?
Dale Strickland-Clark
dale at out-think.NOSPAMco.uk
Tue Nov 7 05:41:05 EST 2000
Both str() and repr() will tell me the name of the class of an
instance but with a load of other info.
How can I get the name alone - without extracting a substring?
Thanks.
>>> class spam:
... pass
...
>>> x = spam()
>>> x
<__main__.spam instance at 17b6908>
>>> str(x)
'<__main__.spam instance at 17b6908>'
>>> repr(x)
'<__main__.spam instance at 17b6908>'
--
Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants
More information about the Python-list
mailing list