Overview
This article shows how to use the platform module in Python. Using this module is useful for displaying information about a computer specs or the current Python version.
Materials
Computer
Python
Importing the Platform Module
import platform
Platform Commands
print(platform.platform())
# Operating System and Version
print(platform.system())
# Displays Name of Operating System
print(platform.release())
# Reads Operating System Version
print(platform.version())
# Displays Version
print(platform.machine())
# Outputs Processor
print(platform.processor())
# Outputs Processor and More Details
print(platform.node())
# Gives the name of the computer or device
print(platform.uname())
# Outputs five attributes: system, node, release, version and machine
By going into a computer's settings, the same information can be found there.
print(platform.python_version())
# Gives the Python Version
print(platform.python_branch())
# The Python build
print(platform.python_revision())
# The Python SCM revision
print(platform.python_build())
# The build and the date
print(platform.python_compiler())
# Shows Python Compiler and Computer Processor
By typing "Python" in the command line, the same information can be found there too.
Sources
https://docs.python.org/3/library/platform.html (1)
Source Code
https://github.com/AndrewDass1/TUTORIALS-AND-NOTES/tree/main/Python/Platform%20Module