How Can I Determine the Operating System with Python?

ingo ingoogni at home.nl
Thu Mar 21 08:42:03 EST 2002


in news:mailman.1016713720.31917.python-list at python.org Mark Gash
wrote: 

> The only way of defining the os name that I have found is then to
> examine the os.environ .By examining the COMSPEC you will be able to
> determine a win 9X machine opposed to an NT or 2000 machine (comspec
> for 9X will show command.com whereas win32 machines will show
> cmd.exe). 
> 

>>> os.environ['OS']
'Windows_NT'

No idea what it does on other platforms.

Ingo



More information about the Python-list mailing list