Why when use sys.platform on Mac os it print “darwin”?

前端 未结 2 1402
猫巷女王i
猫巷女王i 2021-01-01 15:13

In Python, when I type sys.platform on the Mac OS X the output is \"darwin\"? Why is this so?

2条回答
  •  死守一世寂寞
    2021-01-01 15:44

    Because the core of Mac OS X is the Darwin OS.

    Quoting from the linked WikiPedia page:

    Darwin forms the core set of components upon which Mac OS X and iOS are based.

    Even the OS X platform itself reports itself as "Darwin" when you ask it:

    $ uname
    Darwin
    

    Python merely uses that same platform identifier.

提交回复
热议问题