At Saturday 30/9/2006 19:09, Steve Holden wrote:

> while 1:
>      print 'Question [Y/[N]]?',
>      if sys.stdin.readline().strip() in ('Y','y'):
>          #do something
>          pass
>
> $ python q.py
> Question [Y/[N]]?y
>   Question [Y/[N]]?y
>   Question [Y/[N]]?y
>
Yup. When you execute a print statement with a comma at the end it
doesn't output the space, it simply sets a flag reminding it that there
should be a space before the next item on the same line. If the next
character out is a newline then the space flag is reset, but in this
case the newline was provided by the input, so you get a space at the
start of the next output.

You could try using
print '\rQuestion?',


Gabriel Genellina
Softlab SRL

        
        
                
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! http://www.yahoo.com.ar/respuestas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to