The platform module in Python is used to access the underlying platform’s data,
this means information about the device, it’s operating system, Python version, etc
Usage
You start with importing the platform module in your program
import platform
Functions
platform.architecture()
returns information about the bit architecture
platform.machine()
returns the machine type
platform.node()
returns the computer’s network name
platform.platform()
returns a single string identifying the underlying platform with as much useful
information as possible.
platform.processor()
returns the (real) processor name
platform.python_build()
returns a tuple (buildno, builddate) stating the Python build number and
date as strings.
platform.python_compiler()
returns a string identifying the compiler used for compiling Python.
platform.python_version()
returns the Python version as string ‘major.minor.patchlevel’
platform.python_implementation()
returns a string identifying the Python implementation.
platform.release()
returns the system’s release
platform.system()
returns the system/OS name
platform.version()
returns the system’s release version
platform.uname()
returns a tuple of strings (system, node, release, version, machine, processor)
identifying the underlying platform.
Example
import platform print ('uname:', platform.uname()) print ('system :', platform.system()) print ('node :', platform.node()) print ('release :', platform.release()) print ('version :', platform.version()) print ('machine :', platform.machine()) print ('processor:', platform.processor())