views:

30

answers:

2

Can python see which windows i use e.x. windows 7 windows xp windows vista and if windows vista print you use windows vista, or execute other command

+2  A: 

Absolutely. Look at platform.

Ignacio Vazquez-Abrams
platform lives in sys module. import sys sys.platform
Aaron
@Aaron: `sys` has a `platform` attribute, but there is also a separate `platform` module.
Ignacio Vazquez-Abrams
@Ignacio: oh nice, didn't know that
Aaron
nice but what when we want to chose between versions of windows??
geocheats2
Have you had a chance to try the various functions in the module yet?
Ignacio Vazquez-Abrams
i have tryed to search platform.system_alias but how do i know what the alias of every system are??
geocheats2
+1  A: 
import platform
platform.system()  # => 'Windows'
platform.release() # => 'Vista'
platform.version() # => '6.1.7600'

I believe if platform.version() returns a value of 6.1.7000 or higher, you're on a Windows 7 machine, otherwise it is Vista.

Chris G.