Reliably detect Windows in Python

platform-detection, python, windows

Solution

>>> import platform
>>> platform.system()
'Windows'

Problem

I'm working on a couple of Linux tools and need to prevent installation on Windows, since it depends on FHS and is thus rendered useless on that platform. The `platform.platform` function comes close but only returns a string. Unfortunately I don't know what to search for in that string for it to yield a reliable result. Does anyone know what to search for or does anyone know of another function that I'm missing here?

Original source