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 版本的更好方法是什么?
基础教程推荐
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 求两个直方图的卷积 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- 包装空间模型 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
