Problems with print str,

Stefan Heimann stefan.heimann at web.de
Sun Mar 3 15:17:56 EST 2002


Hi!

I have the following code-snippet:

while 1:
  prompt = '> '
  print prompt,
  a = sys.stdin.readline()
  print a

and get the following:

> hello
 hello

>

but I want it to look like:

> hello
hello

>

As you can see, there is a space in the 2nd line that should not be
there. I played around with

>>> sys.stdin.softspace
0
>>> sys.stdout.softspace
0

but couldn't figure out, how to avoid the leading space.

Any help would be great!

Thanks, Stefan



More information about the Python-list mailing list