Python Glossary Русский

Python 3.3+osterm

os.uname_result

os — system

The result type of os.uname(): sysname, nodename, release, version, machine. The type exists everywhere; os.uname itself is Unix-only.

Syntax

os.uname_result(...)

Fields are accessible by name and, for compatibility, by index as a five-item tuple. Values are raw kernel strings: machine gives, for example, 'x86_64' or 'arm64', and architecture names differ between systems ('aarch64' on Linux versus 'arm64' on macOS).

Examples

import os
info = os.uname()  # → ? только Unix: os.uname() возвращает экземпляр os.uname_result
print(info.sysname, info.machine)  # → ? только Unix: имя ядра и архитектура, например Linux x86_64
print(info[0] == info.sysname)  # → True — поля доступны и по индексу, и по имени
print(isinstance(info, tuple))  # → True — uname_result наследуется от tuple, поэтому распаковывается

See also

Open in the full glossarydocs.python.orgReport an inaccuracy