Python Devlopment






OS Version



 

Using the Platform module in Python

 

The platform module in Python is used to access the underlying platform’s data,such as, hardware, operating system, and interpreter version information.The platform module includes tools to see the platform’s hardware, operating system, and interpreter version information where the program is running.

 

Platform Functions

 

platform.platform()

 

 

returns a single string identifying the underlying platform with as much useful information as possible.

 

platform.node() 
returns the computer’s network name (may not be fully qualified!)

 

platform.release()

 

returns the system’s release, e.g. '2.2.0' or 'NT'

 

platform.system() 

 

returns the system/OS name, e.g. 'Linux', 'Windows', or 'Java'.

 

platform.version()  

 

returns the system’s release version, e.g. '#3 on degas'

Write a Python program to verify the operating system name and version of Mobile devices.
import sys
import platform
import os
 
print("OS Type :- " + os.name)
print("Kernel :- " + platform.system())
print("Release Version :- " + platform.release())
print("All kernel & version details :- " + platform.version())
print("Kernel + version :- " + platform.platform())

 

Output:
OS Type :- nt
Kernel :- Windows
Release Version :- 10
All kernel & version details :- 10.0.18362
Kernel + version :- Windows-10-10.0.18362-SP0