all Python 3platformfunction
platform.release()
system and machine
The OS release as a string: the kernel version on Linux ('6.8.0-45-generic'), '10' or '11' on Windows; empty if unknown.
Syntax
platform.release()
On Linux this is the kernel version, not the distribution: Ubuntu 24.04 is not visible here; use freedesktop_os_release() for that. On macOS it returns the Darwin version ('23.4.0') rather than the familiar '14.4', which mac_ver() gives. Do not compare version strings as strings: '10' < '9'.
Examples
import platform
print(platform.release()) # → ? например 6.8.0-45-generic, 11 или 23.4.0
print(platform.release() == platform.uname().release) # → True
See also
Open in the full glossarydocs.python.orgReport an inaccuracy