Python: What OS am I running on?

前端 未结 26 2036
野趣味
野趣味 2020-11-22 05:44

What do I need to look at to see whether I\'m on Windows or Unix, etc?

26条回答
  •  渐次进展
    2020-11-22 06:11

    Watch out if you're on Windows with Cygwin where os.name is posix.

    >>> import os, platform
    >>> print os.name
    posix
    >>> print platform.system()
    CYGWIN_NT-6.3-WOW
    

提交回复
热议问题