通常,这种情况下命令执行会返回“success”或“failure”字符串,所以可以判断是否返回了“failure”来避免这种情况。以下是示例代码:
output = subprocess.check_output(cmd, shell=True)
if "failure" in output.decode('utf-8').lower():
# handle failure case
else:
# handle success case
上一篇:adbmysql排行榜