How to find out operating system

Syver Enstad syver-en+usenet at online.no
Thu Jun 27 17:43:53 EDT 2002


"David LeBlanc" <whisper at oz.net> writes:
> 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'
> >>>
> 

Strange (see below) where is the variable defined on your machine?


Here's what I get.

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.
>>> os.environ['WINOS']
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "d:\devtools\python22\lib\os.py", line 387, in __getitem__
    return self.data[key.upper()]
KeyError: WINOS
>>> 

-- 

Vennlig hilsen 

Syver Enstad



More information about the Python-list mailing list