Printing and prompting adds a mysterious extra space

Christoph Haas email at christoph-haas.de
Sat Oct 1 20:28:53 CEST 2005


Evening...

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:

./test.py
>foobar
 foobar
^----------- 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?

Regards
 Christoph
-- 
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