[python-win32] detecting windows type

John Machin sjmachin at lexicon.net
Thu Sep 8 22:17:10 CEST 2005


Roel Schroeven wrote:

>le dahut wrote:
>  
>
>>Hello,
>>
>>How is it possible to detect which kind of windows a python script is
>>running on ? (9x, Me, 2k, XP, 2k3)
>>    
>>
>
>You can use sys.getwindowsversion() for that. Check MSDN documentation 
>for the precise meaning of the result.
>
>  
>
>  
>
Also check out the platform module:
 >>> import sys
 >>> sys.getwindowsversion()
(5, 1, 2600, 2, 'Service Pack 2')
 >>> import platform as  pl
 >>> pl.platform()
'Windows-XP-5.1.2600-SP2'
 >>> pl.system()
'Windows'
 >>> pl.release()
'XP'
 >>> pl.version()
'5.1.2600'
 >>>


More information about the Python-win32 mailing list