Re: displaying \n-less prompts in a pythonic way

2006-10-27 Thread Hendrik van Rooyen
Steve Holden [EMAIL PROTECTED] wrote: 8--- mystr = raw_input(Who is this? ) Who is this? Steve how did you know how to answer that? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

displaying \n-less prompts in a pythonic way

2006-10-26 Thread alf
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

Re: displaying \n-less prompts in a pythonic way

2006-10-26 Thread Sybren Stuvel
alf enlightened us with: 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

Re: displaying \n-less prompts in a pythonic way

2006-10-26 Thread bearophileHUGS
Sybren Stuvel: def prompt(label): '''Prompts the user, returning the typed text''' sys.stdout.write(label) return sys.stdin.readline() Maybe raw_input function may help too. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: displaying \n-less prompts in a pythonic way

2006-10-26 Thread Steve Holden
Sybren Stuvel wrote: alf enlightened us with: 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

Re: displaying \n-less prompts in a pythonic way

2006-10-26 Thread alf
Steve Holden wrote: Or use raw_input(), which was designed for such situations: thx, did not know about that ... -- http://mail.python.org/mailman/listinfo/python-list