Python 获取当前的操作系统 HenryZ 2020-02-22 更新于 2022-07-06 目录 获取当前是什么操作系统 环境:Python 3 使用 platform.system() import platform print(platform.system()) import platform isWindows = True if platform.system() == 'Windows' else False isMacOS = True if platform.system() == 'Darwin' else False 使用 sys.platform import sys print(sys.platform) # darwin # is macOS # win32 # is Windows Please enable JavaScript to view the comments powered by giscus.