How Can I Determine the Operating System with Python?

Mark Hadfield m.hadfield at niwa.co.nz
Wed Mar 20 21:02:58 EST 2002


"Jill Obsidian" <obsidian_genius at yahoo.com> wrote in message
news:cc779aae.0203201733.3717f882 at posting.google.com...

> How can I put a check in my script which will allow me to determine
> whether I'm running on Windows or Linux at execution time?

>>> import sys
>>> sys.platform
'win32'
>>> import os
>>> os.name
'nt'

--
Mark Hadfield
m.hadfield at niwa.co.nz                   Ka puwaha et tai nei
http://katipo.niwa.co.nz/~hadfield      Hoea tatou
National Institute for Water and Atmospheric Research (NIWA)






More information about the Python-list mailing list