Providing 'default' value with raw_input()?

Roger Upole rupole at
Fri Dec 23 06:05:05 CET 2005

If you have Pywin32 build 205 installed, you can use the
win32console module to add the data to the typeahead
buffer before you call raw_input.

import win32console

def raw_input_with_default(prompt, default_val):
    for c in default_val:
    return raw_input(prompt)

data=raw_input_with_default('modify this: ','some data')
print data


"planetthoughtful" <planetthoughtful at> wrote:
> Hi Steve,
> As keir mentioned, my goal is to be able to edit the value returned
> from a record stored in SQLite, so that it can be updated with the new
> value.
> To give a little background: as a learning exercise I'm writing a
> command line app that will allow me to quickly capture todo items
> (based on a similar concept used by an app for the Mac described on
> I have the functionality working for adding todo items,
> and listing items by various criteria, and updating the status of
> items, but haven't included any functionality for being able to edit
> items.
> It seems, according to kier, that this simply can't be done via the
> command line in DOS, which is a shame.
> Sorry I didn't explain myself very well in my original post.
> Much warmth,
> planetthoughtful

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

More information about the Python-list mailing list