Message268689
| Author |
ned.deily |
| Recipients |
Audric D'Hoest (Dr. Pariolo), lemburg, ned.deily, ronaldoussoren |
| Date |
2016年06月16日.19:12:57 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1466104378.19.0.89055374553.issue27338@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Python's platform module has both platform-independent and platform-dependent functions as noted in its documentation. While it isn't as clearly documented as perhaps it should be, on most "Unix-y" platforms, like OS X, much of the platform-independent system information comes from the same source as the platform's "uname" command. You can see that, if you use platform.uname(), it matches the output of OS X's uname(1) command:
>>> platform.uname()
('Darwin', 'kitt.local', '15.5.0', 'Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-32485021~8/RELEASE_X86_64', 'x86_64', 'i386')
>>> platform.system()
'Darwin'
>>> platform.release()
'15.5.0'
$ uname -a
Darwin kitt.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-32485021~8/RELEASE_X86_64 x86_64
Somewhat confusingly, "Darwin" is how the OS X kernel identifies itself and "15.5.0" is the Darwin version number that corresponds to OS X 10.11.5. And the uname output is what the platform module uses.
For OS X, the platform module does provide a Mac-specific function, platform.mac_ver. From it, you can get the OS X version information, rather than the Darwin kernel information.
>>> platform.mac_ver()
('10.11.5', ('', '', ''), 'x86_64')
Suggestions on how to improve the documentation are welcome! But changing the results from the platform-independent functions after all these years is not likely to happen.
https://docs.python.org/2.7/library/platform.html#cross-platform
https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history |
|