Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edit: For the specific question of <strong>all possible return values</strong>:</p> <ul> <li>Related <a href="https://stackoverflow.com/a/446215/1431750">stackoverflow answer</a> for Possible values from sys.platform?</li> <li><p><strong><a href="http://mail.python.org/pipermail/python-list/2006-August/405455.html" rel="nofollow noreferrer">Post with the answers</a></strong> pointed to above:</p> <blockquote> <pre><code>aix3 aix4 atheos beos5 darwin freebsd2 freebsd3 freebsd4 freebsd5 freebsd6 freebsd7 generic irix5 irix6 linux2 mac netbsd1 next3 os2emx riscos sunos5 unixware7 </code></pre> </blockquote></li> <li><p>Also:</p> <pre><code>linux3, freebsd8, win32, dos, os2 </code></pre> <p>and others.</p></li> <li>(They were <a href="http://mail.python.org/pipermail/python-list/2006-August/377705.html" rel="nofollow noreferrer">asking the same question in Aug 2006</a>.)</li> </ul> <p>Note:</p> <blockquote> <p>As others have indicated, sys.platform is derived from the name that the system vendor gives their system.</p> </blockquote> <p>/Edit.</p> <hr> <p>Not sure it's possible to have something so future-<em>perfect</em>. If you only want to know the OS (mac/win/linux) then see the examples for <a href="http://docs.python.org/library/sys.html#sys.platform" rel="nofollow noreferrer">sys.platform</a>.</p> <p>Also, keeping things in a separate function like <code>get_os_name</code> lets you control or map the input-output if you see a lot of changes in the future - once a year per OS? Also convenient to combine with the other functions you've mentioned. So you can return a tuple based on <code>(os_name, 32/64bit, variant)</code> (where variant is things like XP, Win8, Darwin, etc.) depending on how it affects your script.</p> <blockquote> <p>The docs.python.org sections on each of these modules only lists a few, and the pages are not exactly current.</p> </blockquote> <p>Unfortunately true. But again, it's impossible to account for environments or platforms in the future or even <em>all current</em> ones. The logical thing to do is make sure it works on the current platforms that you have tested/developed for.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload