Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a47e53e4
Kaydet (Commit)
a47e53e4
authored
Eyl 03, 2011
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update sys.platform doc for #12326.
üst
987b1886
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
16 deletions
+26
-16
sys.rst
Doc/library/sys.rst
+26
-16
No files found.
Doc/library/sys.rst
Dosyayı görüntüle @
a47e53e4
...
...
@@ -699,26 +699,36 @@ always available.
This string contains a platform identifier that can be used to append
platform-specific components to :data:`sys.path`, for instance.
For Unix systems, this is the lowercased OS name as returned by ``uname -s``
with the first part of the version as returned by ``uname -r`` appended,
e.g. ``'sunos5'`` or ``'linux2'``, *at the time when Python was built*.
Unless you want to test for a specific system version, it is therefore
recommended to use the following idiom::
if sys.platform.startswith('linux'):
For most Unix systems, this is the lowercased OS name as returned by ``uname
-s`` with the first part of the version as returned by ``uname -r`` appended,
e.g. ``'sunos5'``, *at the time when Python was built*. Unless you want to
test for a specific system version, it is therefore recommended to use the
following idiom::
if sys.platform.startswith('freebsd'):
# FreeBSD-specific code here...
elif sys.platform.startswith('linux'):
# Linux-specific code here...
.. versionchanged:: 3.2.2
Since lots of code check for ``sys.platform == 'linux2'``, and there is
no essential change between Linux 2.x and 3.x, ``sys.platform`` is always
set to ``'linux2'``, even on Linux 3.x. In Python 3.3 and later, the
value will always be set to ``'linux'``, so it is recommended to always
use the ``startswith`` idiom presented above.
For other systems, the values are:
================ ===========================
System :data:`platform` value
================ ===========================
Windows ``'win32'``
Windows/Cygwin ``'cygwin'``
Mac OS X ``'darwin'``
OS/2 ``'os2'``
OS/2 EMX ``'os2emx'``
================ ===========================
====================== ===========================
System :data:`platform` value
====================== ===========================
Linux (2.x *and* 3.x) ``'linux2'``
Windows ``'win32'``
Windows/Cygwin ``'cygwin'``
Mac OS X ``'darwin'``
OS/2 ``'os2'``
OS/2 EMX ``'os2emx'``
====================== ===========================
.. seealso::
:attr:`os.name` has a coarser granularity. :func:`os.uname` gives
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment