[Tutor] Best way to convert a type into string
Bob Gailer
ramrom@earthling.net
Fri Jan 10 12:30:02 2003
--=======1DB154BA=======
Content-Type: text/plain; x-avg-checked=avg-ok-64186D05; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
At 12:38 PM 1/10/2003 +0000, Gon=E7alo Rodrigues wrote:
> > >>> type(1)
> > <type 'int'>
> >
> > What's the best way to get the string "int" from this?
>
>Here is the simplest:
>
> >>> print type(1).__name__
>int
That's what I was looking for. Something already in the language. How does=
=20
one discover things like this? Are they in the documentation? dir(type(1))=
=20
reveals a lot of keys, but __name__ is not amongst them.
Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=======1DB154BA=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-64186D05
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.438 / Virus Database: 246 - Release Date: 1/7/2003
--=======1DB154BA=======--