Get the complete command line as-is

Larry Bates larry.bates at websafe.com
Wed Sep 12 13:18:50 EDT 2007


wangzq wrote:
> Hello,
> 
> I'm passing command line parameters to my browser, I need to pass the
> complete command line as-is, for example:
> 
> test.py "abc def" xyz
> 
> If I use ' '.join(sys.argv[1:]), then the double quotes around "abc
> def" is gone, but I need to pass the complete command line ("abc def"
> xyz) to the browser, how can I do this?
> 
> I'm on Windows.
> 
> Thanks.
> 
Question: If you don't want to parse this as a command line, why don't you read 
it as data via raw input or from some configuration file?

something like:

python program (pgm.py):

cmdline=raw_input("enter your parameters")


external file (cmd.txt):

"abc def" xyz

python pgm.py < cmd.txt

-Larry



More information about the Python-list mailing list