ping命令扫描IP范围并给出具体结果

Scan range of IP with ping command and give specific result

你好,我想在 python 上创建一个 ping 脚本,它将 ping 3 个 ips 并只在服务器处于活动状态时给我结果我想给我丢包并在 ms 时生成时间不到100。我没有 pythong 专家技能

只需用 List 更改主机名并在另一个 Whosebug 线程中给出的代码中提供 ip 地址

Check out this

示例代码

import subprocess
hosts = ['link1','link2','link3']
for host in hosts:
    result = subprocess.check_output("ping google.com")
    print result
    # do some process on result