【发布时间】:2017-03-15 21:07:22
【问题描述】:
我要执行命令:
dir c: | find "File"
文件夹中的文件数。
没有
subprocess.call(['dir c: | find "File"'], shell=True)
或
subprocess.call(['dir', 'c:', '| find "File"'], shell=True)
有效。
Python 将命令翻译成
'"dir c: | find \"file\""'
导致失败。
有什么解决方法吗?
谢谢
【问题讨论】:
标签: windows python-3.x cmd subprocess call