【发布时间】:2020-10-06 04:35:17
【问题描述】:
代码如下,但我发现错误发生的原因,当我运行“cp -rf /tmp/test.py /tmp/blacktest/" 它工作正常
>>> subprocess.call(['cp','-rf','/tmp/test\.py','/tmp/blacktest/'],shell=True)
cp: missing file operand
Try 'cp --help' for more information.
1
【问题讨论】:
-
我也试过 subprocess.call(['cp','-rf','/tmp/test.py','/tmp/blacktest/'],shell=True),但是得到同样的错误
-
shell=True提示:当你运行sh -c cp -rf /tmp/test.py /tmp/balcktest时,你会得到同样的错误。你明白shell是做什么的吗?
标签: linux shell subprocess python-3.6 cp