displaying \n-less prompts in a pythonic way
alf
ask at me
Thu Oct 26 07:24:21 EDT 2006
Hi,
I have a command line program which also does some interaction with the
user using stdin and stdout.
My requirement is to print prompt so the user can answer in the same
line. Unfortunately:
print 'enter command:',
does not really work as the comma is carried over to the following lines
and the indentation gets messed up.
I can use sys.stdout.write('enter command:') instead but kind of do not
like sys.stdout.write mixed up with print's statements used to display
other informations.
Is there a pythonic solution for the problem?
Thx, alf
More information about the Python-list
mailing list