How Can I Determine the Operating System with Python?
eppstein at ics.uci.edu
Thu Mar 21 20:27:20 CET 2002
In article <mailman.1016735254.27977.python-list at python.org>,
Cliff Wells <logiplexsoftware at earthlink.net> wrote:
> > >>> os.environ['OS']
> > 'Windows_NT'
> > No idea what it does on other platforms.
> It depends upon whether the environment variable "OS" is present, so it's
> probably less reliable than sys.platform (doesn't exist on RH Linux, at
Another one where os.environ['OS'] doesn't exist:
>>> import sys
>>> import os
Not sure how you're supposed to distinguish Classic from Darwin...
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list