Python Glossary Русский

Python 3.3+platformterm

platform.uname_result

system and machine

The result type of platform.uname(): a six-field named tuple whose processor field is computed lazily.

Syntax

platform.uname_result(system, node, release, version, machine)

It subclasses a namedtuple with five real fields plus a sixth, the processor property, so repr shows five fields while len(), unpacking and indexing see six. You can build one yourself from five values, but processor then comes from the current machine rather than from your arguments.

Examples

import platform
print(platform.uname_result._fields)  # → ('system', 'node', 'release', 'version', 'machine', 'processor')
r = platform.uname_result('Linux', 'box', '6.8', '#1', 'x86_64')
print(r)  # → uname_result(system='Linux', node='box', release='6.8', version='#1', machine='x86_64')
print(len(r), isinstance(r, tuple))  # → 6 True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy