How to find out operating system

Gustavo Cordova gcordova at hebmex.com
Thu Jun 27 16:41:53 EDT 2002


> 
> C:\>python
> Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit 
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import os
> >>> os.environ.has_key('WINOS')
> 1
> >>> os.environ['WINOS']
> 'WIN2000'
> >>>
> 

Why check if maybe "WINOS" is in the environment?
I've personally never seen that variable. Better
check for "WINDIR", or for "COMSPEC"; the first
is, well, the directory under which Windows is
installed, and I've seen that variable in all
the versions I've used: Win95, 98, ME, NT, 2000;
the other one points to the command shell
for that version of windows.

Good luck :-)

-gus





More information about the Python-list mailing list