Python Glossary Русский

all Python 3platformfunction

platform.platform()

system and machine

One human-readable string describing the system, such as 'Linux-6.8.0-x86_64-with-glibc2.39' or 'Windows-11-10.0.22631-SP0'.

Syntax

platform.platform(aliased=False, terse=False)

The string is meant for people, for logs and bug reports, not for parsing: the format differs between systems and Python versions and may change. For decisions in code use sys.platform or platform.system(). terse=True shortens the output, and aliased=True replaces internal names with marketing ones (SunOS becomes Solaris).

Examples

import platform
print(platform.platform())  # → ? например Linux-6.8.0-x86_64-with-glibc2.39
print(platform.platform(terse=True))  # → ? укороченная форма
print(platform.platform().startswith(platform.system()))  # → ? обычно True, но macOS пишет macOS-, а не Darwin-

See also

Open in the full glossarydocs.python.orgReport an inaccuracy