Possible Duplicate:
How can I return system information in Python?
For example, to see if a Solaris is a Solaris X86 or Solaris SPARC?
Possible Duplicate:
How can I return system information in Python?
For example, to see if a Solaris is a Solaris X86 or Solaris SPARC?
>>> import platform
>>> platform.system()
'Darwin'
>>> platform.processor()
'i386'
>>> platform.platform()
'Darwin-10.8.0-i386-64bit'
>>> platform.machine()
'i386'
>>> platform.version()
'Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386'
>>> platform.uname()
('Darwin', 'Hostname.local', '10.8.0', 'Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386', 'i386', 'i386')
I used the following:
>>> import platform
>>> platform.uname()
('Darwin', 'Matthew-Rankins-MacBook-Pro.local', '10.8.0',
'Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011;
root:xnu-1504.15.3~1/RELEASE_X86_64', 'x86_64', 'i386')
>>>
From the Python platform documentation:
platform.uname()
Fairly portable uname interface. Returns a tuple of strings (system, node, release, version, machine, processor) identifying the underlying platform.
Note that unlike the
os.uname()
function this also returns possible processor information as additional tuple entry.Entries which cannot be determined are set to ''.