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 :: Convert datetime object to a String of date only in Python 
Python :: convert python project to exe 
Python :: pandas split column into multiple columns 
Python :: how to append to a list in python 
Python :: python Sort the dictionary based on values 
Python :: python in stack 
Python :: python check if ip is up or down 
Python :: python - caéculate the average based on the level of a second column in a df 
Python :: python animation 
Python :: python evaluate string 
Python :: check if 2 strings are equal python 
Python :: python tableau 2d 
Python :: cropping image google colab 
Python :: django changing boolean field from view 
Python :: python how to convert a list of floats to a list of strings 
Python :: How to Connect Google Colab to a Local Jupyter Runtime 
Python :: teardown module pytest 
Python :: reading from a file in python 
Python :: python regex find 
Python :: discord.py events 
Python :: python how to check if a dictionary key exists 
Python :: lamda in pyton 
Python :: how to round to 3 significant figures in python 
Python :: append list python 
Python :: python print every character in list as string 
Python :: python how to add columns to a pandas dataframe 
Python :: how to submit two forms in django 
Python :: pandas describe 
Python :: values django 
Python :: destructuring for dict in python 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =