>>> import os
>>> os.name
'posix'
>>> import platform
>>> platform.system()
'Linux'
>>> platform.release()
'2.6.22-15-generic'
The output of platform.system()
is as follows:
- Linux:
Linux
- Mac:
Darwin
- Windows:
Windows
See: platform
— Access to underlying platform’s identifying data
Related Contents:
- How to identify on which OS Python is running on?
- Python: What OS am I running on?
- How can I safely create a nested directory?
- How do you run a Python script as a service in Windows?
- What is the correct cross-platform way to get the home directory in Python?
- Running windows shell commands with python
- What is the return value of os.system() in Python?
- How to share conda environments across platforms
- Python: Platform independent way to modify PATH environment variable
- How can I find the current OS in Python? [duplicate]
- How come a file doesn’t get written until I stop the program?
- Create file but if name exists add number
- Possible values from sys.platform?
- What is a cross-platform way to get the home directory?
- Monitoring contents of files/directories? [duplicate]
- Cross-platform subprocess with hidden window
- How to add a timeout to a function in Python
- What’s the difference between io.open() and os.open() on Python?
- How can I safely create a directory (possibly including intermediate directories)?
- When to use os.name, sys.platform, or platform.system?
- Platform-independent file paths?
- How can I create a ramdisk in Python?
- How can I return system information in Python?
- When using os.execlp, why `python` needs `python` as argv[0]
- Cross-platform way to get PIDs by process name in python
- Cross-platform gui toolkit for deploying Python applications
- How do I create a directory, and any missing parent directories?
- Verify host key with pysftp
- How do I integrate Ajax with Django applications?
- Accessing dict keys like an attribute?
- How to use the pass statement
- How to get indices of a sorted array in Python
- Most efficient way of making an if-elif-elif-else statement when the else is done the most?
- How to construct a timedelta object from a simple string
- How do you pick “x” number of unique numbers from a list in Python?
- Python read from subprocess stdout and stderr separately while preserving order
- How to find the maximum value in a list of tuples? [duplicate]
- Error 28000: Login failed for user DOMAIN\\user with pyodbc
- Python: How to remove empty lists from a list? [duplicate]
- How to concatenate (join) items in a list to a single string
- Changing the tick frequency on the x or y axis
- Python and MySQLdb: substitution of table resulting in syntax error
- Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)
- Constructing 3D Pandas DataFrame
- How to use cmp() in Python 3?
- Understanding the set() function
- Remove unnecessary whitespace from Jinja rendered template
- Python – Rounding by quarter-intervals
- Link to Python with MinGW
- How do you extract a column from a multi-dimensional array?