How to Check Operating System in Python

If you need to check the Operating System information from Python, then you can do one of the following:

Option 1 – Using the platform module

import platform
my_os = platform.system()
print("Operating System is: ",my_os)

Option 2 – Using the sys module

import sys
my_os=sys.platform
print("Operating System is: ",my_os)