背景
dir/s
我一直在批处理文件中使用该命令。但是,我无法使用 python 调用它。注意:我使用的是 Python 2.7.3。
代码
import subprocess
subprocess.call(["dir/s"])
错误信息
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
subprocess.call(["dir/s"])
File "C:\Python27\lib\subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
我曾尝试更改报价,但没有任何效果。
我将如何dir/s
使用 调用模块subprocess
?