Python Glossary Русский

all Python 3platformfunction

platform.uname()

system and machine

A system summary as a named tuple: system, node, release, version, machine, processor. Works on every OS.

Syntax

info = platform.uname()

Unlike os.uname(), it exists on Windows too, and the first fields are named system and node rather than sysname and nodename. The processor field is computed lazily (3.9+), so it is missing from the repr: printing shows five fields although len() is 6. The result is cached for the whole process.

Examples

import platform
info = platform.uname()
print(info.system, info.machine)  # → ? например Linux x86_64
print(len(info))  # → 6
print('processor' in repr(info))  # → False — ленивое поле не печатается

See also

Open in the full glossarydocs.python.orgReport an inaccuracy