readline.insert_text() problem

Joe Ninety joe90 at rchrd1.on.wave.home.com
Wed Apr 10 13:05:10 EDT 2002


I'm writing a script that prompts the user for information that has a 
default value.  When I call raw_input(), I would like the default value to 
be displayed, which the user can then edit or accept as is.

My understanding is that the following should do that, but it does not work 
on my system (Redhat 7.2, Python2.1):


import readline

readline.insert_text("default")
x = raw_input("Enter value: ")
print x


So when the user runs the program, he sees:

Enter value: default

and can edit the word 'default' and hit enter.

Is there any (other) way to do this??


Thanks,
Don





More information about the Python-list mailing list