greetings! i've read your messages and would like to find out more
about what you are trying to do. i will try to help anyway, based on
what you have written so far.

if you are explicitly writing out a response as text/plain, you still
need to write out a string, regardless of the value. you mention using
"print" vs. "write." when you're developing a web application, you
cannot simply use "print" because that is intended for a user and *is*
output to the screen.

with Google App Engine, you're writing a *web application*, and in
such cases, there is no "screen output." rather than a terminal
window, the end consumer of the data you "write" out is to a web
browser. now if by "screen," you mean web browser, then please
disregard what i just said above, because it wasn't clear what you
meant by "screen."

for web applications, you must output either plain text (MIME file
type text/plain) or standard HTML (MIME type text/html). regardless of
whether you use 0, 1, 100, or 1000, as integer literals, or as a value
of a variable 'new_index', you need to convert it to a string first,
i.e., str(0), str(100), str(new_index).

also, if you write this out directly, then the output will be
text/plain. if you want it to look nice in a web browser, you need to
enclose the value in valid HTML:
self.response.out.write('<HTML><BODY>%d</BODY></HTML>' % new_index) or
something similar.

if this doesn't answer your question, hopefully it will help you get
started. or if your problem is completely different, please give us
more information so we can help you better.

thanks!
-wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
   http://corepython.com

wesley.j.chun :: wesc+...@google.com
developer relations :: google app engine


On Mon, Dec 21, 2009 at 11:47 PM, Phoenix <peece...@gmail.com> wrote:
> It works.. but it's of no use to me.. I need to use a variable which
> can have 0 as a value and while debugging I need to be sure whether
> the value of this variable is coming correctly or not..
> It works with "print" but not working with "write"..
> print the "0" isn't my objective.. but I'm just confused why I can't
> print 0...)
> Any other integer is being printed.. then why this issue with 0?
>
> thanks for your reply..
>
> On Dec 22, 12:43 pm, Nickolas Daskalou <n...@daskalou.com> wrote:
>> Have you tried:
>>
>> self.response.out.write(str(0))
>>
>> ?
>>
>> On Dec 22, 5:11 pm, Phoenix <peece...@gmail.com> wrote:
>>
>>
>>
>> > Hi.. this is the code I'm using..
>>
>> > self.response.out.write(0) and "0" is not being on screen.. even if
>> > this "0" an Integer is in some variable.. like this..
>> > new_index = 0
>> > self.response.out.write(new_index)
>>
>> > and nothing comes on screen..
>>
>> > can anyone have any idea?
>>
>> > thanks in advance..

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to