print foo, adds a space to beginning of next line?

Kevin Altis altis at
Wed Jun 6 16:06:27 EDT 2001

I noticed this too when doing some CGIs. Seems like a bug to me.

"George Young" <gry at> wrote in message
news:3B1E7D78.53A5BE30 at
> [python 2.1, intel linux]
> def f():
>      print 'what is your name: ',
>      x=sys.stdin.readline()
>      print 'what is your age: ',
>      y=sys.stdin.readline()
> f()
> what is your name: mememe
>  what is your age: 48
> Why does it print a space at the beginning of the second line?
> If I use sys.stdout.write('what is your name: ') instead, it
> works fine.
> --
> Your mouse has moved.
> Windows NT must be restarted for the change to take effect.
> Reboot now?  [OK]

More information about the Python-list mailing list