raw_input with a pre-compiled data

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Jun 20 12:42:37 EDT 2009


En Sat, 20 Jun 2009 11:17:01 -0300, Luca <lucafbb at gmail.com> escribió:

> 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 do you mean "pre-compile the raw_input input line"?

Maybe you're looking for this:

import os
defpath = os.getcwd()
path = raw_input("Enter path [%s]: " % defpath)
if not path: path = defpath
print "Using path=%s" % path

-- 
Gabriel Genellina




More information about the Python-list mailing list