For Mac OS
platform.mac_ver()
This function returns a tuple containing information such as release, version, machine about the Mac OS. The output is in the following manner:
(release, versioninfo, machine)
In this versioninfo itself is a tuple storing information in the following manner:
(version, dev_stage, non_release_version)
Platform Module in Python
Python defines an in-built module platform that provides system information.
The Platform module is used to retrieve as much possible information about the platform on which the program is being currently executed. Now by platform info, it means information about the device, it’s OS, node, OS version, Python version, etc. This module plays a crucial role when you want to check whether your program is compatible with the python version installed on a particular system or whether the hardware specifications meet the requirements of your program.
This module already exists in the python library and does not require any installation using pip.
It can be imported using the following syntax:
import platform
Example 1: Displaying the platform processor
# Python program to display platform processor # import module import platform # displaying platform processor print ( 'Platform processor:' , platform.processor()) |
Output:
Contact Us