[Tutor] identify python interpreters platform?

Brian van den Broek broek at cc.umanitoba.ca
Wed Oct 26 03:44:40 CEST 2005


Kent Johnson said unto the world upon 2005-10-25 11:46:
> Ed Hotchkiss wrote:
> 
>> Well, on windows XP it returns "nt" for os.name <http://os.name>
>> and for sys.platform it returns win32. how can i determine win2k,
>> xp, 9x, etc etc ...
> 
> 
> I don't know...maybe something in os.environ?
> 

>>> sys.getwindowsversion()
(5, 1, 2600, 2, 'Service Pack 2')
>>> help(sys.getwindowsversion)
Help on built-in function getwindowsversion in module sys:

getwindowsversion(...)
     getwindowsversion()

     Return information about the running version of Windows.
     The result is a tuple of (major, minor, build, platform, text)
     All elements are numbers, except text which is a string.
     Platform may be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows
NT/2000/XP

>>> 

The chm help also says:
> This function wraps the Win32 GetVersionEx() function; see the
> Microsoft documentation for more information about these fields.
> 
> Availability: Windows. New in version 2.3.
> 



More information about the Tutor mailing list