Printing and prompting adds a mysterious extra space

Christoph Haas email at
Sat Oct 1 20:28:53 CEST 2005


I'm writing a simple interactive program to maintain a database.
The goal was to print "> " at the beginning of the line, wait for
user input and then deal with it. Minimal test program:

import sys; print ">", ; print sys.stdin.readline()

However when I run the program and enter "foobar" it looks like this:

^----------- where does this space come from?

I wonder where the space comes from in the line where I print what the
user typed. Does it have to do with the "," after the print which I use
to suppress the newline? Any ideas?

I'm still confused - just on a higher level now.
".signature" [Modified] 1 line --100%--                1,48         All

More information about the Python-list mailing list