analitics

Pages

Monday, June 25, 2012

Access system version information using python platform module.

The platform module includes the tools to take some infos about operating system, and hardware platform where a program is running.

import platform
dir(platform)

Show all about this module.

Also you can use the help.

help(platform)

Let's try another

print platform.win32_ver()
('', '', '', '')

So is not Windosw OS.

print platform.system()
Linux

Can be 'Linux', 'Windows' or 'Java' ...

print platform.version()

Show you the system's release version ( can be Debian , Ubuntu , Fedora ).

print platform.architecture()
('32bit', 'ELF')
print platform.uname()

Show the infos like uname linux command.

print platform.release()

Show the kernel use by system.

print platform.machine()
i686
print platform.node()

Show the computer's network name.

print platform.linux_distribution()

Show you the linux distribution.