Last active
August 15, 2018 23:09
-
-
Save Dan-Patterson/537a75518a3f2bee7f9ffedfd9da99a8 to your computer and use it in GitHub Desktop.
computer info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def comp_info(): | |
"""Return information for the computer and python version | |
comp_info() # to use... | |
""" | |
import platform | |
winv = platform.platform() | |
py_ver = platform.python_version() | |
plat = platform.architecture() | |
proc = platform.processor() | |
p_node = platform._node() | |
u_name = platform.uname() | |
ud = u_name._asdict() | |
udl = list(zip(ud.keys(), ud.values())) | |
frmt = """ | |
--------------------------- | |
Computer/python information | |
Platform: {} | |
python version: {} | |
windows version: {} | |
processor: {} | |
node: {} | |
user/machine: {}\n | |
Alternate form....""" | |
args = [winv, py_ver,plat, proc, p_node, u_name] | |
print(dedent(frmt).format(*args)) | |
print("\n".join(["{:<10}: {}".format(*i) for i in udl])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment