@@ -1367,47 +1367,42 @@ always available.
1367
1367
1368
1368
.. data :: platform
1369
1369
1370
- This string contains a platform identifier that can be used to append
1371
- platform-specific components to :data: `sys.path `, for instance.
1372
-
1373
- For Unix systems, except on Linux and AIX, this is the lowercased OS name as
1374
- returned by ``uname -s `` with the first part of the version as returned by
1375
- ``uname -r `` appended, e.g. ``'sunos5' `` or ``'freebsd8' ``, *at the time
1376
- when Python was built *. Unless you want to test for a specific system
1377
- version, it is therefore recommended to use the following idiom::
1378
-
1379
- if sys.platform.startswith('freebsd'):
1380
- # FreeBSD-specific code here...
1381
- elif sys.platform.startswith('linux'):
1382
- # Linux-specific code here...
1383
- elif sys.platform.startswith('aix'):
1384
- # AIX-specific code here...
1385
-
1386
- For other systems, the values are:
1370
+ A string containing a platform identifier. Known values are:
1387
1371
1388
1372
================ ===========================
1389
1373
System ``platform `` value
1390
1374
================ ===========================
1391
1375
AIX ``'aix' ``
1376
+ Android ``'android' ``
1392
1377
Emscripten ``'emscripten' ``
1378
+ iOS ``'ios' ``
1393
1379
Linux ``'linux' ``
1394
- WASI ``'wasi ' ``
1380
+ macOS ``'darwin ' ``
1395
1381
Windows ``'win32' ``
1396
1382
Windows/Cygwin ``'cygwin' ``
1397
- macOS ``'darwin ' ``
1383
+ WASI ``'wasi ' ``
1398
1384
================ ===========================
1399
1385
1386
+ On Unix systems not listed in the table, the value is the lowercased OS name
1387
+ as returned by ``uname -s ``, with the first part of the version as returned by
1388
+ ``uname -r `` appended, e.g. ``'sunos5' `` or ``'freebsd8' ``, *at the time
1389
+ when Python was built *. Unless you want to test for a specific system
1390
+ version, it is therefore recommended to use the following idiom::
1391
+
1392
+ if sys.platform.startswith('freebsd'):
1393
+ # FreeBSD-specific code here...
1394
+
1400
1395
.. versionchanged :: 3.3
1401
1396
On Linux, :data: `sys.platform ` doesn't contain the major version anymore.
1402
- It is always ``'linux' ``, instead of ``'linux2' `` or ``'linux3' ``. Since
1403
- older Python versions include the version number, it is recommended to
1404
- always use the ``startswith `` idiom presented above.
1397
+ It is always ``'linux' ``, instead of ``'linux2' `` or ``'linux3' ``.
1405
1398
1406
1399
.. versionchanged :: 3.8
1407
1400
On AIX, :data: `sys.platform ` doesn't contain the major version anymore.
1408
- It is always ``'aix' ``, instead of ``'aix5' `` or ``'aix7' ``. Since
1409
- older Python versions include the version number, it is recommended to
1410
- always use the ``startswith `` idiom presented above.
1401
+ It is always ``'aix' ``, instead of ``'aix5' `` or ``'aix7' ``.
1402
+
1403
+ .. versionchanged :: 3.13
1404
+ On Android, :data: `sys.platform ` now returns ``'android' `` rather than
1405
+ ``'linux' ``.
1411
1406
1412
1407
.. seealso ::
1413
1408
0 commit comments