import win32api
def getFileVersion(file_name):
info = win32api.GetFileVersionInfo(file_name, os.sep)
ms = info['FileVersionMS']
ls = info['FileVersionLS']
version = '%d.%d.%d.%04d' % (win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls))
return version
希望本文所述对大家的Python程序设计有所帮助。