📜  使用 python 代码示例 ping

📅  最后修改于: 2022-03-11 14:46:58.176000             🧑  作者: Mango

代码示例1
import subprocess

def main():
    host = input("Enter Host: ")
    packet = int(input("\nEnter Packet: "))
    print("\n")
    ping = subprocess.getoutput(f"ping -w {packet} {host}")
    print(ping)

main()