I want to avoid "" and all other wild characters in the name and arguments of the program, so I'm trying to double them, and I can do this in cmd.exe
C:\bay\test\go>"test.py" "a" "b" "c" hello ['C:\\bay\\test\\go\\test.py', 'a', 'b', 'c']
but what is wrong with the following code using os.sytem?
cmd = '"test.py" "a" "b" "c"' print cmd os.system(cmd)
its conclusion:
C:\bay\test\go>test2.py "test.py" "a" "b" "c" 'test.py" "a" "b" "c' is not recognized as an internal or external command, operable program or batch file.
Why is the entire string "test.py" "a" "b" "c" 'recognized by one command? But the following example:
cmd = 'test.py abc' print cmd os.system(cmd) C:\bay\test\go>test2.py test.py abc hello ['C:\\bay\\test\\go\\test.py', 'a', 'b', 'c']
Thanks!
source share