Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python check operating system

from sys import platform
if platform == "linux" or platform == "linux2":
    # linux
elif platform == "darwin":
    # OS X
elif platform == "win32":
    # Windows...
Comment

detect operating system using python

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

# Output - 
# OS in my system :  Linux
Comment

Python How To Check Operating System

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

Python - How To Check Operating System

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

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
Comment

PREVIOUS NEXT
Code Example
Python :: python function get number of arguments 
Python :: how to delete all instances of a model in django 
Python :: python array get index 
Python :: sum group by pandas and create new column 
Python :: numpy remove columns containing nan 
Python :: split a text file into multiple paragraphs python 
Python :: make a list in python 3 
Python :: re.compile example 
Python :: intersection() Function of sets in python 
Python :: python plot groupby 
Python :: python append filename to path 
Python :: python move cursor to previous line 
Python :: how to make a button in python turtle 
Python :: django queryset first element 
Python :: how to set variable in flask 
Python :: pyspark print a column 
Python :: execute terminal command from python 
Python :: matplotlib vertical line 
Python :: py factors of a number 
Python :: midpoint 
Python :: pytube 
Python :: copy only some columns to new dataframe in r 
Python :: python read scv 
Python :: charts in python 
Python :: pyqt5 image center 
Python :: reading json file 
Python :: python print string name in pattern 
Python :: word2number python 
Python :: check if argv exists python 
Python :: python text input 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =