摘要:
commands模块不支持windows环境,让我们来看看。 查看commands.getoutput的源代码: 这个函数调用的是commands.getstatusoutput()函数,那查看下commands.getstatusoutput的源代码 从commands.getstatusoutp 阅读全文
随笔档案-2015年02月
python 批量ping脚本不能用os.system
2015-02-13 16:01 by kowme, 1258 阅读, 收藏, 编辑
摘要:
os.system(cmd)通过执行命令会得到返回值。 ping通的情况下返回值为0。 ping不通的情况: 1、请求超时,返回值1 2、无法访问目标主机,返回值为 0,和ping通返回值相同 所以建议不用os.system 阅读全文