raw_input with a pre-compiled data

Luca lucafbb at gmail.com
Sun Jun 21 11:28:19 CEST 2009

On Sat, Jun 20, 2009 at 6:38 PM, Chris Rebert<clp2 at rebertia.com> wrote:
> On Sat, Jun 20, 2009 at 7:17 AM, Luca<lucafbb at gmail.com> wrote:
>> Hi all.
>> I need to use a function like the raw_input to read data from user
>> command line, but I really like to pre-compile the choice and I'm not
>> able to do this. There is some other function/module I can use?
>> I wanna to pre-compile the raw_input input line with the current working path.
> What does "pre-compile" mean in this context? It's not clear at all,
> so I can't even understand your question.

I'm really sorry to all that replied... In fact I literally traduced a
concept from italian and the term precompiled was not so clear...

What I mean is this: I wanna that raw_input (or other modules) ask to
the user the data, but some data inserted is already present, to the
user can cancel it with the BACKSPACE key.

Examples below (the "_" is the initial cursor position).

 >>> raw_input("Insert the directory to work: ")
 Insert the directory to work: _

What I need is:
 >>> XXX_raw_input("Insert the directory to work: ", default="/home/john/")
 Insert the directory to work: /home/john_

In the second example a user can cancel the text "/home/john".

I hope this time is more clear, sorry again.

-- luca

More information about the Python-list mailing list