sys.platform on UNIX
Chris Liechti
cliechti at gmx.net
Sun Jul 7 14:16:34 EDT 2002
User & <ingo at hilbert.ingoblank.com> wrote in
news:85bs9jfm4n.fsf at hilbert.ingoblank.com:
> I need a boolean function isUnix(), which returns true,
> if executed on a UNIX OS.
>
> I think it's best, to check the 'sys.platform' string.
not in every case....
> However, there are lots of possibilities:
> 'linux*','freebsd*','sunos*','solaris*','irix*','osx*','hpux' ... etc.
i think thats quite good so, as all that unix like systems are different.
however if you're interested in POSIX compatibility os.name is better:
>>> import os
>>> os.name
'nt'
it will be 'posix' on any os that calls itself a unix clone...
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list