Platform module in Python

--

Python has a very handy module ‘Platform’ that helps to retrieve information about the system or platform on which we are running the code.

# Import Platform module
import platform

# To find out which Python version we are using
print(platform.python_version())
Output: 3.9.2

# To find details of the processor
print(platform.processor())
Output: Intel64 Family 6 Model 69 Stepping 1, GenuineIntel

# To find architecture of platform
print(platform.architecture())
Output: (‘64bit’, ‘WindowsPE’)

# To find Machine details
print(platform.machine())
Output: AMD64

# To get the Operating system information
print(platform.system())
Output: Windows

# To get detailed information about underlying platform
print(platform.platform())
Output: Windows-10–10.0.19041-SP0

# To get platform inormation
print(platform.uname())
Output: uname_result(system=’Windows’, node=’Shekhar27', release=’10', version=’10.0.19041', machine=’AMD64')

--

--

No responses yet