What is platform.win32_edition() in Python?
Overview
The platform module in Python is used to extract system-related information. It allows us to access underlying data, including interpreter, system hardware details, and operating system information.
From the platform module, win32_edition() is used to extract the current Windows edition in string representation. It returns an OS version where the Python interpreter will be running.
Note: New in Python version 3.8.
Syntax
platform.win32_edition()
Parameters
It does not take any argument value.
Return value
It returns either a string or None. If the system has a current Windows version, it returns a string; otherwise, it returns None.
# importing platform moduleimport platform as platform# it will print system release valueprint("System Release: ", platform.release())# it will print OS nameprint("OS Name: ", platform.system())# it will print system versionprint("Platform Version: ", platform.version())# it will print current windows edition.print("Platform Edition: ", platform.win32_edition())
Explanation
- Line 2: We load the
platformmodule in this program.
- Lines 4–8: We print the current system details like system release, its name, and version number.
- Line 10: We invoke the
win32_edition()function from theplatformmodule on the console. It will print an edition of the underlying Windows system.