When to use os.name, sys.platform, or platform.system?

后端 未结 5 453
感情败类
感情败类 2020-11-29 17:18

As far as I know, Python has 3 ways of finding out what operating system is running on:

  1. os.name
  2. sys.platform
5条回答
  •  离开以前
    2020-11-29 17:57

    I believe the platform module is probably preferred for new code. The others existed before it. It is an evolution, and the others remain for backwards compatibility.

提交回复
热议问题