what is better way of getting windows version in python?(在 python 中获取 Windows 版本的更好方法是什么?)
问题描述
我将编写一个执行 Windows 操作系统版本检查的程序,因为我可以使用 sys.windowsversion()[0] 或返回字符串而不是 int 的平台模块来执行此操作,这将是获取 Windows 发布版本的更好方法?
I am going to write a program that performs Windows OS version check, since I can do it with sys.windowsversion()[0] or with platform module that returns string not int what would be better way to get windows release version ?
推荐答案
你可以通过调用 sys.getwindowsversion
.例如这个输出:
You can do it by calling sys.getwindowsversion
. For example this output:
>>> sys.getwindowsversion()
sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
适用于 Windows 7.
is for Windows 7.
来源:http://mail.python.org/pipermail/导师/2003-11月/026227.html
这篇关于在 python 中获取 Windows 版本的更好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 python 中获取 Windows 版本的更好方法是什么?


基础教程推荐
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 合并具有多索引的两个数据帧 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 如何在Python中绘制多元函数? 2022-01-01