double quote escaping in os.system on windows

前端 未结 4 1463
一整个雨季
一整个雨季 2020-12-19 22:01

I want to escape \'\"\' and all other wild chars in program name and arguments, so I try to double quote them. and I can do this in cmd.exe

C:\\bay\\test\\go         


        
4条回答
  •  自闭症患者
    2020-12-19 22:55

    Try with os.system('python "test.py" "a" "b" "c"')

    You can also use subprocess module for that kind of purpose,

    please take a look this thread

    UPDATE:When I do, os.system('"test.py" "a" "b" "c"'), I got similar errors, but not on os.system('test.py "a" "b" "c"'), So, I like to assume that first parameter should not be double-quoted

提交回复
热议问题