For my beginner python article,Check This
This python code will check your Operating System whether you are using Linux,Windows or Mac.
import sys if sys.platform.startswith('win32'): print("Windows") elif sys.platform.startswith('linux2'): print("Linux") elif sys.platform.startswith('cygwin'): print("Windows/Cygwin") elif sys.platform.startswith('darwin'): print("Mac OS X") elif sys.platform.startswith('os2'): print("OS/2") elif sys.platform.startswith('os2emx'): print("OS/2 EMX") elif sys.platform.startswith('riscos'): print("RiscOS") elif sys.platform.startswith('atheos'): print("AtheOS")
Reference:
1) https://docs.python.org/2/library/sys.html#sys.platform
2) stackoverflow [Other Way]