def system(inp):
"""system -- Retrieves information about the host system."""
hostname = platform.node()
os = platform.platform()
python_imp = platform.python_implementation()
python_ver = platform.python_version()
architecture = '-'.join(platform.architecture())
cpu = platform.machine()
with open('/proc/uptime', 'r') as f:
uptime_seconds = float(f.readline().split()[0])
uptime = str(timedelta(seconds = uptime_seconds))
return "Hostname: \x02{}\x02, Operating System: \x02{}\x02, Python " \
"Version: \x02{} {}\x02, Architecture: \x02{}\x02, CPU: \x02{}" \
"\x02, Uptime: \x02{}\x02".format(hostname, os, python_imp, python_ver, architecture, cpu, uptime)
评论列表
文章目录