Entry
Is there a way how I can identify the operating system my Python script is running on (e.g., Linux, Windows, Mac, ...)?
Jul 16th, 2000 21:32
unknown unknown, Emile van Sebille, Mahogany Rush, Matthew Schinckel
Look for Marc Lemburg's platform.py, or use the standard sys.platform.
Python 1.6a2 (#1, May 14 2000, 08:15:17) [GCC 2.8.1] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> sys.platform
'sunos5'
If it is only for compatibilty reasons, you can use os.name.
This will give you one of: ['posix', 'nt', 'dos', 'mac', 'os2', 'ce'].