platform module
A standard module that reports facts about the host: its operating system, hardware and Python build.
In more detail
platform.system(), machine(), processor(), version() and platform() describe the operating system and hardware as strings. python_implementation() names the interpreter, usually 'CPython', and python_version_tuple() returns three strings. The values depend on where the code runs.
Example
import platform
print(platform.python_version_tuple()) # ('3', '14', '7')Related terms
- module — A file of code whose functions, classes and variables other files can use by importing it.
- CPython — The standard implementation of Python, written in the C language, which is what you get from python.org.
- operating system — The base software, such as Linux, Windows or macOS, that runs a computer and lets other programs use it.
Taught in
- Import Variants, dir() And sys.path — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- math, random And platform — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Modules Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep