You can use the platform
library in Python to get the name of the operating system:
main.py85 chars6 lines
This will output the name of the operating system that Python is running on, for example:
main.py21 chars2 lines
You can also use the os
library to get the hostname or computer name of the system:
main.py93 chars6 lines
This will output the name of the computer, for example:
main.py27 chars2 lines
Note that this will only work on Windows operating systems. On other operating systems, you can use the socket
library to get the hostname:
main.py77 chars6 lines
This will output the hostname of the system, for example:
main.py20 chars2 lines
gistlibby LogSnag