我有一个python脚本来为我安装/卸载一些经常使用的程序,它也在卸载后做一些快捷方式/文件夹清理。我曾经使用这段代码删除一个文件夹subprocess.call与os.system有什么不同
os.system('rd /S /Q "{0}\\{1}"'.format(dirname, name))
其中工作得很好。我试图我的os.system
到subprocess.call
使用转换,所以我改变上述行来此
subprocess.call(['rd', '/S', '/Q', '{0}\\{1}'.format(dirname, name)])
但是这给了错误
The system cannot find the file specified (2)
我必须使用正确subprocess.call但我可以” t解决它。任何帮助将不胜感激,谢谢。
[在Python中调用外部命令]可能的副本(https://stackoverflow.com/questions/89228/calling-an-external-command-in-python) – Nabin 2017-11-22 14:02:14