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 :: find the time of our execution in vscode 
Python :: check if two strings are anagrams python 
Python :: extract zip file in python zipfile 
Python :: install python 3.6 dockerfile 
Python :: copy directory from one location to another python 
Python :: ImportError: dynamic module does not define module export function 
Python :: STATIC_ROOT 
Python :: python comment block 
Python :: pythn programme for adding user unputs 
Python :: difference between __str__ and __repr__ 
Python :: how to find the position in a list python 
Python :: how to iterate through ordereddict in python 
Python :: python how to replace a certain string in text 
Python :: python scheduling 
Python :: python get list memory size 
Python :: replace values in a column by condition python 
Python :: python count code, Count number of occurrences of a given substring 
Python :: python get weather 
Python :: how to cout in python 
Python :: models. type for phone number in django 
Python :: convert python float list to 2 digit 
Python :: difference between for loop and while loop in python 
Python :: python remove space from end of string 
Python :: root mean square python 
Python :: selenium open inspect 
Python :: python move a file from one folder to another 
Python :: chatbot python 
Python :: create app in django 
Python :: python datetime offset 
Python :: install different python version debian 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =