raw_input with a pre-compiled data

Dave Angel davea at ieee.org
Sat Jun 20 15:01:34 EDT 2009

Luca 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.
You'll have to define several terms for us:

1) "pre-compile" - Are you coding in Python, or in C, or some other 
compiled language? Microsoft C has (had?) something called pre-compiled 
headers, but they never worked very well, so I kept them disabled.
2) "the choice" - what choice would that be?
3) "this" -  what's this?
4) "current working path" - what does this mean?  Do you perhaps mean 
"current directory" aka "current working directory" ?  Or do you mean 
the path to the __main__ file?

The only thing I can understand clearly is "read data from user command 
line".  You get that from  sys.argv usually, or you can parse it with 
optparse.  Or if you need the line unmodified, AND if you're on Windows, 
you can use the win32 module to call something like GetCommandLine().  
I'd have to check that last one, though.

More information about the Python-list mailing list