如何在 macOS 上获取应用程序的版本?

How to get an application's version on macOS?

我正在使用 python 编写一个简单的脚本,用于 macOS BigSur。我想知道是否有办法使用 python 查找应用程序的版本。我知道在 Windows 上使用 PyWin32 库是可能的,但是,我找不到适用于 MacOS 的任何东西。

感谢@sudden_appearance 的方法

import os
stream = os.popen('mdls -raw -name kMDItemVersion /Applications/Firefox.app')
targetVer = stream.read()
print(targetVer)