Python Platform Module
The platform module provides an API to access the underlying platform's identifying data, such as hardware, operating system, and interpreter version information.
Importing the Module
import platform
System Information
platform.system()
Returns the system/OS name, such as 'Linux', 'Darwin', 'Java', 'Windows'. An empty string is returned if the value cannot be determined.
import platform
print(platform.system())
platform.release()
Returns the system's release, e.g. '2.2.0' or 'NT'.
print(platform.release())
platform.version()
Returns the system's release version.
print(platform.version())
Hardware Information
platform.machine()
Returns the machine type, e.g. 'i386'.
print(platform.machine())
platform.processor()
Returns the (real) processor name, e.g. 'amdk6'.
print(platform.processor())
platform.uname()
Returns a namedtuple containing system, node, release, version, machine, and processor.
print(platform.uname())
Python Version
platform.python_version()
Returns the Python version as string 'major.minor.patchlevel'.
print(platform.python_version())