Puzzling input problem

Stephen R. Figgins fig at monitor.net
Thu Mar 22 01:17:32 CET 2001


I ran into a puzzling problem combining print with raw_input(). 
Normally I would pass the prompt string to raw_input, but instead I
tried something like this: 

  print "prompt string: ",
  answer = raw_input()
  print answer

When it prints answer, it is indented one space.  Why is raw_input()
putting a space in there?  Is it a bug, a feature, an unintended side
effect?  input() does this too.   I am currently using Active Python 2.0
build 202.

When I tried it with Jython 2.0, I didn't get the extra space. 


Stephen



More information about the Python-list mailing list