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 版本的更好方法是什么?
- 如何将一个类的函数分成多个文件? 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12
- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 沿轴计算直方图 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- python-m http.server 443--使用SSL? 2022-01-01
