when i type into the Console(CMD) "winver" i will get my windows version (The four numbers left of the build number, example: 1803,1903,1909,2004,20H2) But how can i get my windows version in python? i already tried:
import os
os.system("winver")
input()
But then it will open a new window like in the cmd, but i just want to print the winver without the rest, therefore i did this:
import os
os.system("Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseId")
input()
But here is the problem that a string is in a string. "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
How can i fix that? Please help!
you can use platform module
import platform
print(platform.platform())
print(platform.system())
print(platform.release())
print(platform.version())
print(platform.version().split('.')[2])
print(platform.machine())
output:
Windows-10-10.0.19041-SP0
Windows
10
10.0.19041
19041
AMD64