SoFunction
Updated on 2024-11-16

Python to get the version number of DLL and EXE files

This article example describes the method of Python to get the version number of DLL and EXE files. Shared for your reference. Specific implementation methods are as follows:

Copy Code The code is as follows.
import win32api
def getFileVersion(file_name):
    info = (file_name, )
    ms = info['FileVersionMS']
    ls = info['FileVersionLS']
    version = '%d.%d.%d.%04d' % ((ms), (ms), (ls), (ls))
    return version

I hope that what I have described in this article will help you in your Python programming.