For debug use I want to show the type of a variable in Google App Engine.
In traditional environment, I will use "print type( x )" to do it. But in GAE I just don’t know why I can’t use self.response.out.write( str( type( x ) ) ) to echo it in the browser. I got confused because I did transform the <type 'type'> to < type 'str' >.
Since that doesn’t work I have to use self.response.out.write( str( type( x) == type( "123" ) ) ) instead of directly echoing the type.
So what did I miss in thinking?
I am also using logging module to echo the type which works well. But I still want to know why self.response.out.write( ) doesn’t work.
Thanks all for help!!
When browser renders html it thinks that
<type 'str'>is a (unknown) tag, so it renders it as<type 'str'></type>, hence it becomes part of your page markup… You can see this with Firebug or any similar tool.