通过Python判断主机是否存在

2023-01-31 01:01:37 判断 主机 是否存在


判断对方主机是否存在!


import os

status = os.system("ping -c 1 www.baidu.com");

if status == 0:
    print '连接成功!';
else:
    print '连接失败';



相关文章