469,949 Members | 2,244 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,949 developers. It's quick & easy.

Starting value with raw_input

Does the raw_input built-in function allow giving an initial value that
the user can edit?
Perhaps by using the readline module?

I want to do something so that I can provide the user a default value
they can edit as they wish at the prompt:

result = raw_input("Enter value: ")
#### Somehow output default value so prompt looks like:

Enter value: default

they can edit "default" to whatever they want, and I'll get the result.

Does what I'm asking make sense?

mediocre nebula.

Apr 19 '06 #1
1 1775
Kinda ugly, and I lifted it from an old post, but this should work:

import readline
readline.insert_text('supercalifragilisticexpialid ocious'))
new_value = raw_input()

Apr 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by J. W. McCall | last post: by
reply views Thread by dale | last post: by
21 posts views Thread by planetthoughtful | last post: by
17 posts views Thread by Stuart McGraw | last post: by
2 posts views Thread by Etienne Hilson | last post: by
8 posts views Thread by Dox33 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.