As I understand it, you'd like your program to instantly show something like this:
Enter something: something _
(Where _ is the shell's caret)
So that if you pressed enter, raw_input
would return the string "something" - or you could press Backspace and edit the pre-filled input.
The simple answer is no, you cannot do this. The problem is that it is not Python handling the input at that point - it is your shell (bash, cmd, etc.) Only after you type something and press enter is that input "delivered" back to Python.
A library like readline
will allow for something like what you want, but will only work on versions of Python linked against readline (usually Linux). See this answer for more.
An alternative that many programs use is to show a default value after the prompt, which is assumed if no input is given. This function should mimic this behavior:
def raw_input_default(prompt, default):
result = raw_input('{0} [{1}] '.format(prompt, default))
if result == '':
result = default
return result
Usage:
>>> print raw_input_default('Enter name:', 'Joe')
Enter name: [Joe] John
John
>>> print raw_input_default('Enter name:', 'Joe')
Enter name: [Joe]
Joe