Convert type() to string?

Adonis deltapigz at telocity.com
Tue Nov 12 18:32:13 EST 2002


Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> t = type('test')
>>> t
<type 'str'>

then just parse the text.
not the best way but someone will respond with better code.

hope this helps.

Adonis

"Robert Oschler" <Oschler at earthlink.net> wrote in message
news:s2gA9.47879$Lg2.13805658 at news2.news.adelphia.net...
> I want to be able to print out the type() of a string for a "structure
> walker" I'm writing.  I need to be able to prepend a string of pad
> characters to the type() so the following:
>
> print padstr + type(x)
>
> won't work because type() does not return a string.  What's a good way to
do
> this?  I'm using Python 2.1 + Python 2.2 (2.1 for Jython).
>
> thx
>
>
>





More information about the Python-list mailing list