python如果有几万个ip 如果快速的扫描返回是否alive

2025-04-08 19:26:25
推荐回答(1个)
回答1:

def ping(host): '''ping 1次指定地址''' import subprocess,traceback, platform if platform.system()=='Windows': cmd = 'ping -n %d %s'%(1,host) else: cmd = 'ping -c %d %s'%(1,host) try: p = subprocess.Popen(args=cmd, shell=True, s...