Platform Library

The platform library provides access to underlying platform’s identifying data.

Import

import platform

Available Functions

Function Description
architecture() Returns bit architecture info
machine() Returns machine type (e.g., ‘arm64’)
node() Returns computer’s network name
platform(aliased=0, terse=0) Returns platform identifier string
processor() Returns processor name
python_version() Returns Python/Scriptling version
release() Returns system release
system() Returns system name (e.g., ‘Darwin’)
version() Returns system version

Functions

architecture()

Returns a tuple (bits, linkage) containing information about the bit architecture and the linkage format.

print(platform.architecture())
# Output: ('64bit', '')

machine()

Returns the machine type, e.g. ‘i386’. An empty string is returned if the value cannot be determined.

print(platform.machine())
# Output: 'arm64'

node()

Returns the computer’s network name (may not be fully qualified!). An empty string is returned if the value cannot be determined.

print(platform.node())
# Output: 'my-computer.local'

platform(aliased=0, terse=0)

Returns a single string identifying the underlying platform with as much useful information as possible.

print(platform.platform())
# Output: 'Darwin-21.6.0-arm64-arm-64bit'

processor()

Returns the (real) processor name, e.g. ‘amdk6’.

print(platform.processor())
# Output: 'arm'

python_version()

Returns the Python version as string ‘major.minor.patchlevel’. Note: In Scriptling, this returns the Scriptling version for compatibility.

print(platform.python_version())
# Output: '1.0.0'

release()

Returns the system’s release, e.g. ‘2.2.0’ or ‘NT’.

print(platform.release())
# Output: '21.6.0'

scriptling_version()

Returns the Scriptling version as string.

print(platform.scriptling_version())
# Output: '1.0.0'

system()

Returns the system/OS name, e.g. ‘Linux’, ‘Windows’, or ‘Java’. An empty string is returned if the value cannot be determined.

print(platform.system())
# Output: 'Darwin'

uname()

Returns a dictionary containing system information. Note: Unlike Python which returns a namedtuple, Scriptling returns a dictionary with keys: system, node, release, version, machine, processor.

info = platform.uname()
print(info["system"])
# Output: 'Darwin'

version()

Returns the system’s release version, e.g. ‘#3 on degas’.

print(platform.version())
# Output: 'Darwin Kernel Version 21.6.0...'