有没有快速了解另一台计算机状态的方法?

Is there a quick way to know the status of another computer?

我需要知道十台电脑的状态。

正在尝试使用 "PING",我在十秒内得到了信息。

我想要在 Windows7 64.

中获取此信息的更快捷方式

代码:

from platform import system as system_name # Returns the system/OS name
from os import system as system_call       # Execute a shell command
def ping(host):

# Ping parameters as function of OS
parameters = "-n 1" if system_name().lower()=="windows" else "-c 1"

# Pinging
return system_call("ping " + parameters + " " + host) == 0

谢谢!

尝试使用子进程

import subprocess

def ping(host):

    # Ping parameters as function of OS
    parameters = "-n" if system_name().lower()=="windows" else "-c"

    # Pinging
    return subprocess.Popen(["ping", host, parameters, '1'], stdout=subprocess.PIPE).stdout.read()