Get the complete command line as-is
TheFlyingDutchman
zzbbaadd at aol.com
Wed Sep 12 01:15:25 EDT 2007
>
> It seems that \" will retain the quote marks but then the spaces get
> gobbled.
>
> But if you replace the spaces with another character:
>
> python.exe test.py \"abc#def\"#123
>
> then:
>
> import sys
> commandLine = "".join(sys.argv[1:])
>
> prints commandLine.replace('#',' ')
>
> gives:
>
> "abc def" 123
>
> Don't know if you can use that technique or not.
Came back for a second try and found out that:
python.exe test.py "\"abc def\" 123"
import sys
commandLine = "".join(sys.argv[1:])
print commandLine
gives:
"abc def" 123
More information about the Python-list
mailing list