Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Detect the Operating System Using the sys Module in Python

# The sys module can also be used to find the operating system of the device.
# We use the platform attribute of the sys module to get the operating system’s name
# on our device.

import sys

my_os=sys.platform
print("OS in my system : ",my_os)

# Output:

# OS in my system :  linux

# Whenever you want to specifically distinguish your system in between win32 and
# cygwin, this method can be very useful.


# This approach can also be helpful when we want to specifically distinguish your
# system in between win32 and cygwin.


# For other operating system sys.platform outputs as:

# `win32`   for Windows(Win32)
# 'cygwin'  for Windows(cygwin)
# 'darwin'  for macOS
# 'aix'     for AIX
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Detect #Operating #System #Using #sys #Module #Python
ADD COMMENT
Topic
Name
2+9 =