Ping a site in Python?

前端 未结 15 2259
我寻月下人不归
我寻月下人不归 2020-11-22 09:22

How do I ping a website or IP address with Python?

15条回答
  •  死守一世寂寞
    2020-11-22 09:35

    import subprocess as s
    ip=raw_input("Enter the IP/Domain name:")
    if(s.call(["ping",ip])==0):
        print "your IP is alive"
    else:
        print "Check ur IP"
    

提交回复
热议问题