Skip to content

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)
Code language: Python (python)

Option 2 – Using the sys module

import sys my_os=sys.platform print("Operating System is: ",my_os)
Code language: Python (python)

See also  [Solved] ERROR 1030 (HY000): Got error 168 from storage engine
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x