python scripts are terminated when the windows version less than target is closed

To isolate the build number:

winver = str(sys.getwindowsversion()).split(', ')
for i in winver:
    if 'build=' in i:
        build_lst = [winver[i] for i in [winver.index(i)]]
build_num = int(" ".join(str(i) for i in build_lst)[6:])

The ‘winver’ variable is the sys.getwindowsversion() in list form. Search for the string ‘build=’ for each element in winver. Create a new string from that element’s index and isolate the integers. Final variable is stored as build_num.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top