sys.getwindowsversion()
Return a named tuple describing the Windows version currently running. The named elements are major, minor, build, platform, service_pack, service_pack_minor, service_pack_major, suite_mask, and product_type. service_pack contains a string while all other values are integers. The components can also be accessed by name, so sys.getwindowsversion()[0]
is equivalent to sys.getwindowsversion().major
. For compatibility with prior versions, only the first 5 elements are retrievable by indexing.
platform may be one of the following values:
Constant | Platform |
---|---|
0 (VER_PLATFORM_WIN32s) | Win32s on Windows 3.1 |
1 (VER_PLATFORM_WIN32_WINDOWS) | Windows 95/98/ME |
2 (VER_PLATFORM_WIN32_NT) | Windows NT/2000/XP/x64 |
3 (VER_PLATFORM_WIN32_CE) | Windows CE |
product_type may be one of the following values:
Constant | Meaning |
---|---|
1 (VER_NT_WORKSTATION) | The system is a workstation. |
2 (VER_NT_DOMAIN_CONTROLLER) | The system is a domain controller. |
3 (VER_NT_SERVER) | The system is a server, but not a domain controller. |
This function wraps the Win32 GetVersionEx()
function; see the Microsoft documentation on OSVERSIONINFOEX()
for more information about these fields.
Availability: Windows.
Changed in version 3.2: Changed to a named tuple and added service_pack_minor, service_pack_major, suite_mask, and product_type.
Please login to continue.