How Can I Determine the Operating System with Python?
theller at python.net
Thu Mar 21 14:34:48 CET 2002
> > >>> import sys
> > >>> sys.platform
> > 'win32'
> > >>> import os
> > >>> os.name
> > 'nt'
> That's a crude way of determining the platform, because sys.platform
> depends on the compiler used to compile Python. Yes, even on Windows.
> But I'm reasonably sure that the Pythonlabs folks won't change their
> Windows compiler anytime soon.
> I'd very much like to have a real way for determining the platform.
> Anybody wants to write a PEP? :-)
IIRC Marc Andre Lemburg has written a platform.py script, which may
even make it into the official Python lib (?).
More information about the Python-list