How do I check if I’m running on Windows in Python? [duplicate]

This question already has answers here: Python: What OS am I running on? (26 answers) Closed 7 years ago. I found the platform module but it says it returns ‘Windows’ and it’s returning ‘Microsoft’ on my machine. I notice in another thread here on stackoverflow it returns ‘Vista’ sometimes. So, the question is, how do … Read more

Python: What OS am I running on?

What do I need to look at to see whether I’m on Windows or Unix, etc? 26 s 26 >>> import os >>> os.name ‘posix’ >>> import platform >>> platform.system() ‘Linux’ >>> platform.release() ‘2.6.22-15-generic’ The output of platform.system() is as follows: Linux: Linux Mac: Darwin Windows: Windows See: platform — Access to underlying platform’s identifying … Read more