【发布时间】:2017-08-18 18:15:12
【问题描述】:
我试图在不使用 shell=True 关键字参数的情况下运行带有 subprocess.check_output 的命令。我的命令是这样的:
command --parameter="something with spaces"
有了这个:
subprocess.check_output(['command', '--parameter="something with spaces"'])
命令变成这样:
command "--parameter=\"something with spaces\""
还有这个:
subprocess.check_output(['command', '--parameter=', 'something with spaces'])
命令变成这个(=之后的空格):
command --parameter= "something with spaces"
有没有不使用shell=True的正确方法
【问题讨论】:
标签: python shell subprocess