Team Ai
Apppublic

parthtamu/rag-code-assistant

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
platform.html751 linesDownload Raw Back to docs
1<!DOCTYPE html>2 3<html lang="en" data-content_root="../">4  <head>5    <meta charset="utf-8" />6    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />7<meta property="og:title" content="platform —  Access to underlying platform’s identifying data" />8<meta property="og:type" content="website" />9<meta property="og:url" content="https://docs.python.org/3/library/platform.html" />10<meta property="og:site_name" content="Python documentation" />11<meta property="og:description" content="Source code: Lib/platform.py Cross platform: Windows platform: macOS platform: iOS platform: Unix platforms: Linux platforms: Android platform: Command-line usage: platform can also be invoked dire..." />12<meta property="og:image:width" content="1146" />13<meta property="og:image:height" content="600" />14<meta property="og:image" content="https://docs.python.org/3.15/_images/social_previews/summary_library_platform_8a01ca39.png" />15<meta property="og:image:alt" content="Source code: Lib/platform.py Cross platform: Windows platform: macOS platform: iOS platform: Unix platforms: Linux platforms: Android platform: Command-line usage: platform can also be invoked dire..." />16<meta name="description" content="Source code: Lib/platform.py Cross platform: Windows platform: macOS platform: iOS platform: Unix platforms: Linux platforms: Android platform: Command-line usage: platform can also be invoked dire..." />17<meta name="twitter:card" content="summary_large_image" />18<meta name="theme-color" content="#3776ab">19 20    <title>platform — Access to underlying platform’s identifying data &#8212; Python 3.15.0a6 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">21    22    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=b86133f3" />23    <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=234b1a7c" />24    <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=89a2f22a" />25    <link rel="stylesheet" type="text/css" href="../_static/profiling-sampling-visualization.css?v=0c2600ae" />26    <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=5349f25f" />27    28    <script src="../_static/documentation_options.js?v=6b7c9ff5"></script>29    <script src="../_static/doctools.js?v=9bcbadda"></script>30    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>31    <script src="../_static/profiling-sampling-visualization.js?v=9811ed04"></script>32    33    <script src="../_static/sidebar.js"></script>34    35    <link rel="search" type="application/opensearchdescription+xml"36          title="Search within Python 3.15.0a6 documentation"37          href="../_static/opensearch.xml"/>38    <link rel="author" title="About these documents" href="../about.html" />39    <link rel="index" title="Index" href="../genindex.html" />40    <link rel="search" title="Search" href="../search.html" />41    <link rel="copyright" title="Copyright" href="../copyright.html" />42    <link rel="next" title="errno — Standard errno system symbols" href="errno.html" />43    <link rel="prev" title="logging.handlers — Logging handlers" href="logging.handlers.html" />44    45      46      <script defer file-types="bz2,epub,zip" data-domain="docs.python.org" src="https://analytics.python.org/js/script.file-downloads.outbound-links.js"></script>47      48      <link rel="canonical" href="https://docs.python.org/3/library/platform.html">49      50    51 52    53    <style>54      @media only screen {55        table.full-width-table {56            width: 100%;57        }58      }59    </style>60<link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">61    <link rel="shortcut icon" type="image/png" href="../_static/py.svg">62            <script type="text/javascript" src="../_static/copybutton.js"></script>63            <script type="text/javascript" src="../_static/menu.js"></script>64            <script type="text/javascript" src="../_static/search-focus.js"></script>65            <script type="text/javascript" src="../_static/themetoggle.js"></script> 66            <script type="text/javascript" src="../_static/rtd_switcher.js"></script>67            <meta name="readthedocs-addons-api-version" content="1">68 69  </head>70<body>71<div class="mobile-nav">72    <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"73           aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu">74    <nav class="nav-content" role="navigation">75        <label for="menuToggler" class="toggler__label">76            <span></span>77        </label>78        <span class="nav-items-wrapper">79            <a href="https://www.python.org/" class="nav-logo">80                <img src="../_static/py.svg" alt="Python logo">81            </a>82            <span class="version_switcher_placeholder"></span>83            <form role="search" class="search" action="../search.html" method="get">84                <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">85                    <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>86                </svg>87                <input placeholder="Quick search" aria-label="Quick search" type="search" name="q">88                <input type="submit" value="Go">89            </form>90        </span>91    </nav>92    <div class="menu-wrapper">93        <nav class="menu" role="navigation" aria-label="main navigation">94            <div class="language_switcher_placeholder"></div>95            96<label class="theme-selector-label">97    Theme98    <select class="theme-selector" oninput="activateTheme(this.value)">99        <option value="auto" selected>Auto</option>100        <option value="light">Light</option>101        <option value="dark">Dark</option>102    </select>103</label>104  <div>105    <h3><a href="../contents.html">Table of Contents</a></h3>106    <ul>107<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> —  Access to underlying platform’s identifying data</a><ul>108<li><a class="reference internal" href="#cross-platform">Cross platform</a></li>109<li><a class="reference internal" href="#windows-platform">Windows platform</a></li>110<li><a class="reference internal" href="#macos-platform">macOS platform</a></li>111<li><a class="reference internal" href="#ios-platform">iOS platform</a></li>112<li><a class="reference internal" href="#unix-platforms">Unix platforms</a></li>113<li><a class="reference internal" href="#linux-platforms">Linux platforms</a></li>114<li><a class="reference internal" href="#android-platform">Android platform</a></li>115<li><a class="reference internal" href="#command-line-usage">Command-line usage</a></li>116</ul>117</li>118</ul>119 120  </div>121  <div>122    <h4>Previous topic</h4>123    <p class="topless"><a href="logging.handlers.html"124                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging.handlers</span></code> — Logging handlers</a></p>125  </div>126  <div>127    <h4>Next topic</h4>128    <p class="topless"><a href="errno.html"129                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">errno</span></code> — Standard errno system symbols</a></p>130  </div>131  <script>132    document.addEventListener('DOMContentLoaded', () => {133        const title = document.querySelector('meta[property="og:title"]').content;134        const elements = document.querySelectorAll('.improvepage');135        const pageurl = window.location.href.split('?')[0];136        elements.forEach(element => {137            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));138            url.searchParams.set('pagetitle', title);139            url.searchParams.set('pageurl', pageurl);140            url.searchParams.set('pagesource', "library/platform.rst");141            element.href = url.toString();142        });143    });144  </script>145  <div role="note" aria-label="source link">146    <h3>This page</h3>147    <ul class="this-page-menu">148      <li><a href="../bugs.html">Report a bug</a></li>149      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>150      <li>151        <a href="https://github.com/python/cpython/blob/main/Doc/library/platform.rst?plain=1"152            rel="nofollow">Show source153        </a>154      </li>155      156    </ul>157  </div>158        </nav>159    </div>160</div>161 162  163    <div class="related" role="navigation" aria-label="Related">164      <h3>Navigation</h3>165      <ul>166        <li class="right" style="margin-right: 10px">167          <a href="../genindex.html" title="General Index"168             accesskey="I">index</a></li>169        <li class="right" >170          <a href="../py-modindex.html" title="Python Module Index"171             >modules</a> |</li>172        <li class="right" >173          <a href="errno.html" title="errno — Standard errno system symbols"174             accesskey="N">next</a> |</li>175        <li class="right" >176          <a href="logging.handlers.html" title="logging.handlers — Logging handlers"177             accesskey="P">previous</a> |</li>178 179          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>180          <li><a href="https://www.python.org/">Python</a> &#187;</li>181          <li class="switchers">182            <div class="language_switcher_placeholder"></div>183            <div class="version_switcher_placeholder"></div>184          </li>185          <li>186              187          </li>188    <li id="cpython-language-and-version">189      <a href="../index.html">3.15.0a6 Documentation</a> &#187;190    </li>191 192          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>193          <li class="nav-item nav-item-2"><a href="allos.html" accesskey="U">Generic Operating System Services</a> &#187;</li>194        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> —  Access to underlying platform’s identifying data</a></li>195                <li class="right">196                    197 198    <div class="inline-search" role="search">199        <form class="inline-search" action="../search.html" method="get">200          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">201          <input type="submit" value="Go">202        </form>203    </div>204                     |205                </li>206            <li class="right">207<label class="theme-selector-label">208    Theme209    <select class="theme-selector" oninput="activateTheme(this.value)">210        <option value="auto" selected>Auto</option>211        <option value="light">Light</option>212        <option value="dark">Dark</option>213    </select>214</label> |</li>215            216      </ul>217    </div>    218 219    <div class="document">220      <div class="documentwrapper">221        <div class="bodywrapper">222          <div class="body" role="main">223            224  <section id="module-platform">225<span id="platform-access-to-underlying-platform-s-identifying-data"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> —  Access to underlying platform’s identifying data<a class="headerlink" href="#module-platform" title="Link to this heading">¶</a></h1>226<p><strong>Source code:</strong> <a class="extlink-source reference external" href="https://github.com/python/cpython/tree/main/Lib/platform.py">Lib/platform.py</a></p>227<hr class="docutils" />228<div class="admonition note">229<p class="admonition-title">Note</p>230<p>Specific platforms listed alphabetically, with Linux included in the Unix231section.</p>232</div>233<section id="cross-platform">234<h2>Cross platform<a class="headerlink" href="#cross-platform" title="Link to this heading">¶</a></h2>235<dl class="py function">236<dt class="sig sig-object py" id="platform.architecture">237<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">architecture</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">executable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">sys.executable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bits</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">linkage</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.architecture" title="Link to this definition">¶</a></dt>238<dd><p>Queries the given executable (defaults to the Python interpreter binary) for239various architecture information.</p>240<p>Returns a tuple <code class="docutils literal notranslate"><span class="pre">(bits,</span> <span class="pre">linkage)</span></code> which contain information about the bit241architecture and the linkage format used for the executable. Both values are242returned as strings.</p>243<p>Values that cannot be determined are returned as given by the parameter presets.244If bits is given as <code class="docutils literal notranslate"><span class="pre">''</span></code>, the <code class="docutils literal notranslate"><span class="pre">sizeof(pointer)</span></code> (or245<code class="docutils literal notranslate"><span class="pre">sizeof(long)</span></code> on Python version &lt; 1.5.2) is used as indicator for the246supported pointer size.</p>247<p>The function relies on the system’s <code class="file docutils literal notranslate"><span class="pre">file</span></code> command to do the actual work.248This is available on most if not all Unix  platforms and some non-Unix platforms249and then only if the executable points to the Python interpreter.  Reasonable250defaults are used when the above needs are not met.</p>251<div class="admonition note">252<p class="admonition-title">Note</p>253<p>On macOS (and perhaps other platforms), executable files may be254universal files containing multiple architectures.</p>255<p>To get at the “64-bitness” of the current interpreter, it is more256reliable to query the <a class="reference internal" href="sys.html#sys.maxsize" title="sys.maxsize"><code class="xref py py-data docutils literal notranslate"><span class="pre">sys.maxsize</span></code></a> attribute:</p>257<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">is_64bits</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">maxsize</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="o">**</span><span class="mi">32</span>258</pre></div>259</div>260</div>261</dd></dl>262 263<dl class="py function">264<dt class="sig sig-object py" id="platform.machine">265<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">machine</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.machine" title="Link to this definition">¶</a></dt>266<dd><p>Returns the machine type, e.g. <code class="docutils literal notranslate"><span class="pre">'AMD64'</span></code>. An empty string is returned if the267value cannot be determined.</p>268<p>The output is platform-dependent and may differ in casing and naming conventions.</p>269</dd></dl>270 271<dl class="py function">272<dt class="sig sig-object py" id="platform.node">273<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">node</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.node" title="Link to this definition">¶</a></dt>274<dd><p>Returns the computer’s network name (may not be fully qualified!). An empty275string is returned if the value cannot be determined.</p>276</dd></dl>277 278<dl class="py function">279<dt class="sig sig-object py" id="platform.platform">280<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">platform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">aliased</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">terse</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.platform" title="Link to this definition">¶</a></dt>281<dd><p>Returns a single string identifying the underlying platform with as much useful282information as possible.</p>283<p>The output is intended to be <em>human readable</em> rather than machine parseable. It284may look different on different platforms and this is intended.</p>285<p>If <em>aliased</em> is true, the function will use aliases for various platforms that286report system names which differ from their common names, for example SunOS will287be reported as Solaris.  The <a class="reference internal" href="#platform.system_alias" title="platform.system_alias"><code class="xref py py-func docutils literal notranslate"><span class="pre">system_alias()</span></code></a> function is used to implement288this.</p>289<p>Setting <em>terse</em> to true causes the function to return only the absolute minimum290information needed to identify the platform.</p>291<div class="versionchanged">292<p><span class="versionmodified changed">Changed in version 3.8: </span>On macOS, the function now uses <a class="reference internal" href="#platform.mac_ver" title="platform.mac_ver"><code class="xref py py-func docutils literal notranslate"><span class="pre">mac_ver()</span></code></a>, if it returns a293non-empty release string, to get the macOS version rather than the darwin294version.</p>295</div>296</dd></dl>297 298<dl class="py function">299<dt class="sig sig-object py" id="platform.processor">300<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">processor</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.processor" title="Link to this definition">¶</a></dt>301<dd><p>Returns the (real) processor name, e.g. <code class="docutils literal notranslate"><span class="pre">'amdk6'</span></code>.</p>302<p>An empty string is returned if the value cannot be determined. Note that many303platforms do not provide this information or simply return the same value as for304<a class="reference internal" href="#platform.machine" title="platform.machine"><code class="xref py py-func docutils literal notranslate"><span class="pre">machine()</span></code></a>.  NetBSD does this.</p>305</dd></dl>306 307<dl class="py function">308<dt class="sig sig-object py" id="platform.python_build">309<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_build</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_build" title="Link to this definition">¶</a></dt>310<dd><p>Returns a tuple <code class="docutils literal notranslate"><span class="pre">(buildno,</span> <span class="pre">builddate)</span></code> stating the Python build number and311date as strings.</p>312</dd></dl>313 314<dl class="py function">315<dt class="sig sig-object py" id="platform.python_compiler">316<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_compiler</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_compiler" title="Link to this definition">¶</a></dt>317<dd><p>Returns a string identifying the compiler used for compiling Python.</p>318</dd></dl>319 320<dl class="py function">321<dt class="sig sig-object py" id="platform.python_branch">322<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_branch</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_branch" title="Link to this definition">¶</a></dt>323<dd><p>Returns a string identifying the Python implementation SCM branch.</p>324</dd></dl>325 326<dl class="py function">327<dt class="sig sig-object py" id="platform.python_implementation">328<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_implementation</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_implementation" title="Link to this definition">¶</a></dt>329<dd><p>Returns a string identifying the Python implementation. Possible return values330are: ‘CPython’, ‘IronPython’, ‘Jython’, ‘PyPy’.</p>331</dd></dl>332 333<dl class="py function">334<dt class="sig sig-object py" id="platform.python_revision">335<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_revision</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_revision" title="Link to this definition">¶</a></dt>336<dd><p>Returns a string identifying the Python implementation SCM revision.</p>337</dd></dl>338 339<dl class="py function">340<dt class="sig sig-object py" id="platform.python_version">341<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_version" title="Link to this definition">¶</a></dt>342<dd><p>Returns the Python version as string <code class="docutils literal notranslate"><span class="pre">'major.minor.patchlevel'</span></code>.</p>343<p>Note that unlike the Python <code class="docutils literal notranslate"><span class="pre">sys.version</span></code>, the returned value will always344include the patchlevel (it defaults to 0).</p>345</dd></dl>346 347<dl class="py function">348<dt class="sig sig-object py" id="platform.python_version_tuple">349<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">python_version_tuple</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.python_version_tuple" title="Link to this definition">¶</a></dt>350<dd><p>Returns the Python version as tuple <code class="docutils literal notranslate"><span class="pre">(major,</span> <span class="pre">minor,</span> <span class="pre">patchlevel)</span></code> of strings.</p>351<p>Note that unlike the Python <code class="docutils literal notranslate"><span class="pre">sys.version</span></code>, the returned value will always352include the patchlevel (it defaults to <code class="docutils literal notranslate"><span class="pre">'0'</span></code>).</p>353</dd></dl>354 355<dl class="py function">356<dt class="sig sig-object py" id="platform.release">357<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">release</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.release" title="Link to this definition">¶</a></dt>358<dd><p>Returns the system’s release, e.g. <code class="docutils literal notranslate"><span class="pre">'2.2.0'</span></code> or <code class="docutils literal notranslate"><span class="pre">'NT'</span></code>. An empty string is359returned if the value cannot be determined.</p>360</dd></dl>361 362<dl class="py function">363<dt class="sig sig-object py" id="platform.system">364<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">system</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.system" title="Link to this definition">¶</a></dt>365<dd><p>Returns the system/OS name, such as <code class="docutils literal notranslate"><span class="pre">'Linux'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Darwin'</span></code>, <code class="docutils literal notranslate"><span class="pre">'Java'</span></code>,366<code class="docutils literal notranslate"><span class="pre">'Windows'</span></code>. An empty string is returned if the value cannot be determined.</p>367<p>On iOS and Android, this returns the user-facing OS name (i.e, <code class="docutils literal notranslate"><span class="pre">'iOS</span></code>,368<code class="docutils literal notranslate"><span class="pre">'iPadOS'</span></code> or <code class="docutils literal notranslate"><span class="pre">'Android'</span></code>). To obtain the kernel name (<code class="docutils literal notranslate"><span class="pre">'Darwin'</span></code> or369<code class="docutils literal notranslate"><span class="pre">'Linux'</span></code>), use <a class="reference internal" href="os.html#os.uname" title="os.uname"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.uname()</span></code></a>.</p>370</dd></dl>371 372<dl class="py function">373<dt class="sig sig-object py" id="platform.system_alias">374<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">system_alias</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">system</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">release</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.system_alias" title="Link to this definition">¶</a></dt>375<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">(system,</span> <span class="pre">release,</span> <span class="pre">version)</span></code> aliased to common marketing names used376for some systems.  It also does some reordering of the information in some cases377where it would otherwise cause confusion.</p>378</dd></dl>379 380<dl class="py function">381<dt class="sig sig-object py" id="platform.version">382<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.version" title="Link to this definition">¶</a></dt>383<dd><p>Returns the system’s release version, e.g. <code class="docutils literal notranslate"><span class="pre">'#3</span> <span class="pre">on</span> <span class="pre">degas'</span></code>. An empty string is384returned if the value cannot be determined.</p>385<p>On iOS and Android, this is the user-facing OS version. To obtain the386Darwin or Linux kernel version, use <a class="reference internal" href="os.html#os.uname" title="os.uname"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.uname()</span></code></a>.</p>387</dd></dl>388 389<dl class="py function">390<dt class="sig sig-object py" id="platform.uname">391<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">uname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.uname" title="Link to this definition">¶</a></dt>392<dd><p>Fairly portable uname interface. Returns a <a class="reference internal" href="collections.html#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a>393containing six attributes: <a class="reference internal" href="#platform.system" title="platform.system"><code class="xref py py-attr docutils literal notranslate"><span class="pre">system</span></code></a>, <a class="reference internal" href="#platform.node" title="platform.node"><code class="xref py py-attr docutils literal notranslate"><span class="pre">node</span></code></a>, <a class="reference internal" href="#platform.release" title="platform.release"><code class="xref py py-attr docutils literal notranslate"><span class="pre">release</span></code></a>,394<a class="reference internal" href="#platform.version" title="platform.version"><code class="xref py py-attr docutils literal notranslate"><span class="pre">version</span></code></a>, <a class="reference internal" href="#platform.machine" title="platform.machine"><code class="xref py py-attr docutils literal notranslate"><span class="pre">machine</span></code></a>, and <a class="reference internal" href="#platform.processor" title="platform.processor"><code class="xref py py-attr docutils literal notranslate"><span class="pre">processor</span></code></a>.</p>395<p><a class="reference internal" href="#platform.processor" title="platform.processor"><code class="xref py py-attr docutils literal notranslate"><span class="pre">processor</span></code></a> is resolved late, on demand.</p>396<p>Note: the first two attribute names differ from the names presented by397<a class="reference internal" href="os.html#os.uname" title="os.uname"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.uname()</span></code></a>, where they are named <code class="xref py py-attr docutils literal notranslate"><span class="pre">sysname</span></code> and398<code class="xref py py-attr docutils literal notranslate"><span class="pre">nodename</span></code>.</p>399<p>Entries which cannot be determined are set to <code class="docutils literal notranslate"><span class="pre">''</span></code>.</p>400<div class="versionchanged">401<p><span class="versionmodified changed">Changed in version 3.3: </span>Result changed from a tuple to a <a class="reference internal" href="collections.html#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a>.</p>402</div>403<div class="versionchanged">404<p><span class="versionmodified changed">Changed in version 3.9: </span><a class="reference internal" href="#platform.processor" title="platform.processor"><code class="xref py py-attr docutils literal notranslate"><span class="pre">processor</span></code></a> is resolved late instead of immediately.</p>405</div>406</dd></dl>407 408<dl class="py function">409<dt class="sig sig-object py" id="platform.invalidate_caches">410<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">invalidate_caches</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.invalidate_caches" title="Link to this definition">¶</a></dt>411<dd><p>Clear out the internal cache of information, such as the <a class="reference internal" href="#platform.uname" title="platform.uname"><code class="xref py py-func docutils literal notranslate"><span class="pre">uname()</span></code></a>.412This is typically useful when the platform’s <a class="reference internal" href="#platform.node" title="platform.node"><code class="xref py py-func docutils literal notranslate"><span class="pre">node()</span></code></a> is changed413by an external process and one needs to retrieve the updated value.</p>414<div class="versionadded">415<p><span class="versionmodified added">Added in version 3.14.</span></p>416</div>417</dd></dl>418 419</section>420<section id="windows-platform">421<h2>Windows platform<a class="headerlink" href="#windows-platform" title="Link to this heading">¶</a></h2>422<dl class="py function">423<dt class="sig sig-object py" id="platform.win32_ver">424<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">win32_ver</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">release</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">csd</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ptype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.win32_ver" title="Link to this definition">¶</a></dt>425<dd><p>Get additional version information from the Windows Registry and return a tuple426<code class="docutils literal notranslate"><span class="pre">(release,</span> <span class="pre">version,</span> <span class="pre">csd,</span> <span class="pre">ptype)</span></code> referring to OS release, version number,427CSD level (service pack) and OS type (multi/single processor). Values which428cannot be determined are set to the defaults given as parameters (which all429default to an empty string).</p>430<p>As a hint: <em>ptype</em> is <code class="docutils literal notranslate"><span class="pre">'Uniprocessor</span> <span class="pre">Free'</span></code> on single processor NT machines431and <code class="docutils literal notranslate"><span class="pre">'Multiprocessor</span> <span class="pre">Free'</span></code> on multi processor machines. The <code class="docutils literal notranslate"><span class="pre">'Free'</span></code> refers432to the OS version being free of debugging code. It could also state <code class="docutils literal notranslate"><span class="pre">'Checked'</span></code>433which means the OS version uses debugging code, i.e. code that checks arguments,434ranges, etc.</p>435</dd></dl>436 437<dl class="py function">438<dt class="sig sig-object py" id="platform.win32_edition">439<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">win32_edition</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.win32_edition" title="Link to this definition">¶</a></dt>440<dd><p>Returns a string representing the current Windows edition, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if the441value cannot be determined.  Possible values include but are not limited to442<code class="docutils literal notranslate"><span class="pre">'Enterprise'</span></code>, <code class="docutils literal notranslate"><span class="pre">'IoTUAP'</span></code>, <code class="docutils literal notranslate"><span class="pre">'ServerStandard'</span></code>, and <code class="docutils literal notranslate"><span class="pre">'nanoserver'</span></code>.</p>443<div class="versionadded">444<p><span class="versionmodified added">Added in version 3.8.</span></p>445</div>446</dd></dl>447 448<dl class="py function">449<dt class="sig sig-object py" id="platform.win32_is_iot">450<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">win32_is_iot</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.win32_is_iot" title="Link to this definition">¶</a></dt>451<dd><p>Return <code class="docutils literal notranslate"><span class="pre">True</span></code> if the Windows edition returned by <a class="reference internal" href="#platform.win32_edition" title="platform.win32_edition"><code class="xref py py-func docutils literal notranslate"><span class="pre">win32_edition()</span></code></a>452is recognized as an IoT edition.</p>453<div class="versionadded">454<p><span class="versionmodified added">Added in version 3.8.</span></p>455</div>456</dd></dl>457 458</section>459<section id="macos-platform">460<h2>macOS platform<a class="headerlink" href="#macos-platform" title="Link to this heading">¶</a></h2>461<dl class="py function">462<dt class="sig sig-object py" id="platform.mac_ver">463<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">mac_ver</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">release</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">versioninfo</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">('',</span> <span class="pre">'',</span> <span class="pre">'')</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">machine</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.mac_ver" title="Link to this definition">¶</a></dt>464<dd><p>Get macOS version information and return it as tuple <code class="docutils literal notranslate"><span class="pre">(release,</span> <span class="pre">versioninfo,</span>465<span class="pre">machine)</span></code> with <em>versioninfo</em> being a tuple <code class="docutils literal notranslate"><span class="pre">(version,</span> <span class="pre">dev_stage,</span>466<span class="pre">non_release_version)</span></code>.</p>467<p>Entries which cannot be determined are set to <code class="docutils literal notranslate"><span class="pre">''</span></code>.  All tuple entries are468strings.</p>469</dd></dl>470 471</section>472<section id="ios-platform">473<h2>iOS platform<a class="headerlink" href="#ios-platform" title="Link to this heading">¶</a></h2>474<dl class="py function">475<dt class="sig sig-object py" id="platform.ios_ver">476<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">ios_ver</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">system</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">release</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_simulator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.ios_ver" title="Link to this definition">¶</a></dt>477<dd><p>Get iOS version information and return it as a478<a class="reference internal" href="collections.html#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a> with the following attributes:</p>479<ul class="simple">480<li><p><code class="docutils literal notranslate"><span class="pre">system</span></code> is the OS name; either <code class="docutils literal notranslate"><span class="pre">'iOS'</span></code> or <code class="docutils literal notranslate"><span class="pre">'iPadOS'</span></code>.</p></li>481<li><p><code class="docutils literal notranslate"><span class="pre">release</span></code> is the iOS version number as a string (e.g., <code class="docutils literal notranslate"><span class="pre">'17.2'</span></code>).</p></li>482<li><p><code class="docutils literal notranslate"><span class="pre">model</span></code> is the device model identifier; this will be a string like483<code class="docutils literal notranslate"><span class="pre">'iPhone13,2'</span></code> for a physical device, or <code class="docutils literal notranslate"><span class="pre">'iPhone'</span></code> on a simulator.</p></li>484<li><p><code class="docutils literal notranslate"><span class="pre">is_simulator</span></code> is a boolean describing if the app is running on a485simulator or a physical device.</p></li>486</ul>487<p>Entries which cannot be determined are set to the defaults given as488parameters.</p>489</dd></dl>490 491</section>492<section id="unix-platforms">493<h2>Unix platforms<a class="headerlink" href="#unix-platforms" title="Link to this heading">¶</a></h2>494<dl class="py function">495<dt class="sig sig-object py" id="platform.libc_ver">496<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">libc_ver</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">executable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">sys.executable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lib</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">version</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">chunksize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">16384</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.libc_ver" title="Link to this definition">¶</a></dt>497<dd><p>Tries to determine the libc version against which the file executable (defaults498to the Python interpreter) is linked.  Returns a tuple of strings <code class="docutils literal notranslate"><span class="pre">(lib,</span>499<span class="pre">version)</span></code> which default to the given parameters in case the lookup fails.</p>500<p>Note that this function has intimate knowledge of how different libc versions501add symbols to the executable is probably only usable for executables compiled502using <strong class="program">gcc</strong>.</p>503<p>The file is read and scanned in chunks of <em>chunksize</em> bytes.</p>504</dd></dl>505 506</section>507<section id="linux-platforms">508<h2>Linux platforms<a class="headerlink" href="#linux-platforms" title="Link to this heading">¶</a></h2>509<dl class="py function">510<dt class="sig sig-object py" id="platform.freedesktop_os_release">511<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">freedesktop_os_release</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#platform.freedesktop_os_release" title="Link to this definition">¶</a></dt>512<dd><p>Get operating system identification from <code class="docutils literal notranslate"><span class="pre">os-release</span></code> file and return513it as a dict. The <code class="docutils literal notranslate"><span class="pre">os-release</span></code> file is a <a class="reference external" href="https://www.freedesktop.org/software/systemd/man/os-release.html">freedesktop.org standard</a> and514is available in most Linux distributions. A noticeable exception is515Android and Android-based distributions.</p>516<p>Raises <a class="reference internal" href="exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">OSError</span></code></a> or subclass when neither <code class="docutils literal notranslate"><span class="pre">/etc/os-release</span></code> nor517<code class="docutils literal notranslate"><span class="pre">/usr/lib/os-release</span></code> can be read.</p>518<p>On success, the function returns a dictionary where keys and values are519strings. Values have their special characters like <code class="docutils literal notranslate"><span class="pre">&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">$</span></code>520unquoted. The fields <code class="docutils literal notranslate"><span class="pre">NAME</span></code>, <code class="docutils literal notranslate"><span class="pre">ID</span></code>, and <code class="docutils literal notranslate"><span class="pre">PRETTY_NAME</span></code> are always521defined according to the standard. All other fields are optional. Vendors522may include additional fields.</p>523<p>Note that fields like <code class="docutils literal notranslate"><span class="pre">NAME</span></code>, <code class="docutils literal notranslate"><span class="pre">VERSION</span></code>, and <code class="docutils literal notranslate"><span class="pre">VARIANT</span></code> are strings524suitable for presentation to users. Programs should use fields like525<code class="docutils literal notranslate"><span class="pre">ID</span></code>, <code class="docutils literal notranslate"><span class="pre">ID_LIKE</span></code>, <code class="docutils literal notranslate"><span class="pre">VERSION_ID</span></code>, or <code class="docutils literal notranslate"><span class="pre">VARIANT_ID</span></code> to identify526Linux distributions.</p>527<p>Example:</p>528<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span><span class="w"> </span><span class="nf">get_like_distro</span><span class="p">():</span>529    <span class="n">info</span> <span class="o">=</span> <span class="n">platform</span><span class="o">.</span><span class="n">freedesktop_os_release</span><span class="p">()</span>530    <span class="n">ids</span> <span class="o">=</span> <span class="p">[</span><span class="n">info</span><span class="p">[</span><span class="s2">&quot;ID&quot;</span><span class="p">]]</span>531    <span class="k">if</span> <span class="s2">&quot;ID_LIKE&quot;</span> <span class="ow">in</span> <span class="n">info</span><span class="p">:</span>532        <span class="c1"># ids are space separated and ordered by precedence</span>533        <span class="n">ids</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">info</span><span class="p">[</span><span class="s2">&quot;ID_LIKE&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">())</span>534    <span class="k">return</span> <span class="n">ids</span>535</pre></div>536</div>537<div class="versionadded">538<p><span class="versionmodified added">Added in version 3.10.</span></p>539</div>540</dd></dl>541 542</section>543<section id="android-platform">544<h2>Android platform<a class="headerlink" href="#android-platform" title="Link to this heading">¶</a></h2>545<dl class="py function">546<dt class="sig sig-object py" id="platform.android_ver">547<span class="sig-prename descclassname"><span class="pre">platform.</span></span><span class="sig-name descname"><span class="pre">android_ver</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">release</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">api_level</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">manufacturer</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_emulator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#platform.android_ver" title="Link to this definition">¶</a></dt>548<dd><p>Get Android device information. Returns a <a class="reference internal" href="collections.html#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">namedtuple()</span></code></a>549with the following attributes. Values which cannot be determined are set to550the defaults given as parameters.</p>551<ul class="simple">552<li><p><code class="docutils literal notranslate"><span class="pre">release</span></code> - Android version, as a string (e.g. <code class="docutils literal notranslate"><span class="pre">&quot;14&quot;</span></code>).</p></li>553<li><p><code class="docutils literal notranslate"><span class="pre">api_level</span></code> - API level of the running device, as an integer (e.g. <code class="docutils literal notranslate"><span class="pre">34</span></code>554for Android 14). To get the API level which Python was built against, see555<a class="reference internal" href="sys.html#sys.getandroidapilevel" title="sys.getandroidapilevel"><code class="xref py py-func docutils literal notranslate"><span class="pre">sys.getandroidapilevel()</span></code></a>.</p></li>556<li><p><code class="docutils literal notranslate"><span class="pre">manufacturer</span></code> - <a class="reference external" href="https://developer.android.com/reference/android/os/Build#MANUFACTURER">Manufacturer name</a>.</p></li>557<li><p><code class="docutils literal notranslate"><span class="pre">model</span></code> - <a class="reference external" href="https://developer.android.com/reference/android/os/Build#MODEL">Model name</a> –558typically the marketing name or model number.</p></li>559<li><p><code class="docutils literal notranslate"><span class="pre">device</span></code> - <a class="reference external" href="https://developer.android.com/reference/android/os/Build#DEVICE">Device name</a> –560typically the model number or a codename.</p></li>561<li><p><code class="docutils literal notranslate"><span class="pre">is_emulator</span></code> - <code class="docutils literal notranslate"><span class="pre">True</span></code> if the device is an emulator; <code class="docutils literal notranslate"><span class="pre">False</span></code> if it’s562a physical device.</p></li>563</ul>564<p>Google maintains a <a class="reference external" href="https://storage.googleapis.com/play_public/supported_devices.html">list of known model and device names</a>.</p>565<div class="versionadded">566<p><span class="versionmodified added">Added in version 3.13.</span></p>567</div>568</dd></dl>569 570</section>571<section id="command-line-usage">572<span id="platform-cli"></span><h2>Command-line usage<a class="headerlink" href="#command-line-usage" title="Link to this heading">¶</a></h2>573<p><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> can also be invoked directly using the <a class="reference internal" href="../using/cmdline.html#cmdoption-m"><code class="xref std std-option docutils literal notranslate"><span class="pre">-m</span></code></a>574switch of the interpreter:</p>575<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">-</span><span class="n">m</span> <span class="n">platform</span> <span class="p">[</span><span class="o">--</span><span class="n">terse</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">nonaliased</span><span class="p">]</span> <span class="p">[{</span><span class="n">nonaliased</span><span class="p">,</span><span class="n">terse</span><span class="p">}</span> <span class="o">...</span><span class="p">]</span>576</pre></div>577</div>578<p>The following options are accepted:</p>579<dl class="std option">580<dt class="sig sig-object std" id="cmdoption-platform-terse">581<span class="sig-name descname"><span class="pre">--terse</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-platform-terse" title="Link to this definition">¶</a></dt>582<dd><p>Print terse information about the platform. This is equivalent to583calling <a class="reference internal" href="#platform.platform" title="platform.platform"><code class="xref py py-func docutils literal notranslate"><span class="pre">platform.platform()</span></code></a> with the <em>terse</em> argument set to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>584</dd></dl>585 586<dl class="std option">587<dt class="sig sig-object std" id="cmdoption-platform-nonaliased">588<span class="sig-name descname"><span class="pre">--nonaliased</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-platform-nonaliased" title="Link to this definition">¶</a></dt>589<dd><p>Print platform information without system/OS name aliasing. This is590equivalent to calling <a class="reference internal" href="#platform.platform" title="platform.platform"><code class="xref py py-func docutils literal notranslate"><span class="pre">platform.platform()</span></code></a> with the <em>aliased</em> argument591set to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p>592</dd></dl>593 594<p>You can also pass one or more positional arguments (<code class="docutils literal notranslate"><span class="pre">terse</span></code>, <code class="docutils literal notranslate"><span class="pre">nonaliased</span></code>)595to explicitly control the output format. These behave similarly to their596corresponding options.</p>597</section>598</section>599 600 601            <div class="clearer"></div>602          </div>603        </div>604      </div>605      <div class="sphinxsidebar" role="navigation" aria-label="Main">606        <div class="sphinxsidebarwrapper">607  <div>608    <h3><a href="../contents.html">Table of Contents</a></h3>609    <ul>610<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> —  Access to underlying platform’s identifying data</a><ul>611<li><a class="reference internal" href="#cross-platform">Cross platform</a></li>612<li><a class="reference internal" href="#windows-platform">Windows platform</a></li>613<li><a class="reference internal" href="#macos-platform">macOS platform</a></li>614<li><a class="reference internal" href="#ios-platform">iOS platform</a></li>615<li><a class="reference internal" href="#unix-platforms">Unix platforms</a></li>616<li><a class="reference internal" href="#linux-platforms">Linux platforms</a></li>617<li><a class="reference internal" href="#android-platform">Android platform</a></li>618<li><a class="reference internal" href="#command-line-usage">Command-line usage</a></li>619</ul>620</li>621</ul>622 623  </div>624  <div>625    <h4>Previous topic</h4>626    <p class="topless"><a href="logging.handlers.html"627                          title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">logging.handlers</span></code> — Logging handlers</a></p>628  </div>629  <div>630    <h4>Next topic</h4>631    <p class="topless"><a href="errno.html"632                          title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">errno</span></code> — Standard errno system symbols</a></p>633  </div>634  <script>635    document.addEventListener('DOMContentLoaded', () => {636        const title = document.querySelector('meta[property="og:title"]').content;637        const elements = document.querySelectorAll('.improvepage');638        const pageurl = window.location.href.split('?')[0];639        elements.forEach(element => {640            const url = new URL(element.href.split('?')[0].replace("-nojs", ""));641            url.searchParams.set('pagetitle', title);642            url.searchParams.set('pageurl', pageurl);643            url.searchParams.set('pagesource', "library/platform.rst");644            element.href = url.toString();645        });646    });647  </script>648  <div role="note" aria-label="source link">649    <h3>This page</h3>650    <ul class="this-page-menu">651      <li><a href="../bugs.html">Report a bug</a></li>652      <li><a class="improvepage" href="../improve-page-nojs.html">Improve this page</a></li>653      <li>654        <a href="https://github.com/python/cpython/blob/main/Doc/library/platform.rst?plain=1"655            rel="nofollow">Show source656        </a>657      </li>658      659    </ul>660  </div>661        </div>662<div id="sidebarbutton" title="Collapse sidebar">663<span>«</span>664</div>665 666      </div>667      <div class="clearer"></div>668    </div>  669    <div class="related" role="navigation" aria-label="Related">670      <h3>Navigation</h3>671      <ul>672        <li class="right" style="margin-right: 10px">673          <a href="../genindex.html" title="General Index"674             >index</a></li>675        <li class="right" >676          <a href="../py-modindex.html" title="Python Module Index"677             >modules</a> |</li>678        <li class="right" >679          <a href="errno.html" title="errno — Standard errno system symbols"680             >next</a> |</li>681        <li class="right" >682          <a href="logging.handlers.html" title="logging.handlers — Logging handlers"683             >previous</a> |</li>684 685          <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"></li>686          <li><a href="https://www.python.org/">Python</a> &#187;</li>687          <li class="switchers">688            <div class="language_switcher_placeholder"></div>689            <div class="version_switcher_placeholder"></div>690          </li>691          <li>692              693          </li>694    <li id="cpython-language-and-version">695      <a href="../index.html">3.15.0a6 Documentation</a> &#187;696    </li>697 698          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>699          <li class="nav-item nav-item-2"><a href="allos.html" >Generic Operating System Services</a> &#187;</li>700        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">platform</span></code> —  Access to underlying platform’s identifying data</a></li>701                <li class="right">702                    703 704    <div class="inline-search" role="search">705        <form class="inline-search" action="../search.html" method="get">706          <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box">707          <input type="submit" value="Go">708        </form>709    </div>710                     |711                </li>712            <li class="right">713<label class="theme-selector-label">714    Theme715    <select class="theme-selector" oninput="activateTheme(this.value)">716        <option value="auto" selected>Auto</option>717        <option value="light">Light</option>718        <option value="dark">Dark</option>719    </select>720</label> |</li>721            722      </ul>723    </div>  724    <div class="footer">725    &copy; <a href="../copyright.html">Copyright</a> 2001 Python Software Foundation.726    <br>727    This page is licensed under the Python Software Foundation License Version 2.728    <br>729    Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.730    <br>731    732      See <a href="/license.html">History and License</a> for more information.<br>733    734    735    <br>736 737    The Python Software Foundation is a non-profit corporation.738<a href="https://www.python.org/psf/donations/">Please donate.</a>739<br>740    <br>741      Last updated on Mar 10, 2026 (08:58 UTC).742    743      <a href="/bugs.html">Found a bug</a>?744    745    <br>746 747    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.748    </div>749 750  </body>751</html>