如何使用python写批处理
1个回答
展开全部
import subprocess
import sys
ret = subprocess.check_call(['ls', '-l'])
if ret != 0:
# something wrong! To deal with the exception
sys.exit(ret)
ret = subprocess.check_call(['rm', '-f', 'file_to_delete'])
if ret != 0:
# similar to the above
#......
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询