where the extra space comes from on the stdout

alf ask at me
Sat Sep 30 16:50:53 EDT 2006


Hi,

I can not find out where the extra space comes from. Run following:

import os,sys
while 1:
     print 'Question [Y/[N]]?',
     if sys.stdin.readline().strip() in ('Y','y'):
         #do something
         pass

$ python q.py
Question [Y/[N]]?y
  Question [Y/[N]]?y
  Question [Y/[N]]?y
  Question [Y/[N]]?y
  Question [Y/[N]]?n
  Question [Y/[N]]?
  Question [Y/[N]]?


There is a space evrywhere just before Q

Any insight?

-- 
alfz1



More information about the Python-list mailing list