On this page
platform.system
Prev: platform.release | Up: platform | Next: platform.system_alias
Rel: platform.android_ver, platform.AndroidVer, platform.architecture, platform.freedesktop_os_release
Ref: docs.python.org — platform.system
Tags: #public #python3 #stdlib #platform
Import
import platform
from platform import system
Signature & Overview
platform.system()
Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.
Usage
import platform
os_name = platform.system()
assert os_name in ("Darwin", "Linux", "Windows") or isinstance(os_name, str)
Gotchas
- Returns
"Darwin"on macOS (not"macOS"),"Linux"on Linux,"Windows"on Windows.
REPL Inspect
from platform import system
help(system)
Linked from
Related notes
- tuts/python3/stdlib_module/platform/release Linked here; links to this page; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/system_alias Linked here; links to this page; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/android_ver Linked here; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/AndroidVer Linked here; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/architecture Linked here; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/freedesktop_os_release Linked here; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/platform Linked here; shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/platform/invalidate_caches shared tags: #platform, #stdlib
- tuts/python3/stdlib_module/platform/ios_ver shared tags: #platform, #stdlib