Question: How to find Firefox version using python?

Answer: 
I tried Alan's code snippet and it didn't work for me. One problem with it is that in order for the "-v or -version" flags to work, you must have a debug version firefox. See [here](https://developer.mozilla.org/En/Command_Line_Options) under "Miscellaneous" for details.

Try the following, which uses the win32 library to read the Product Version string directly from the .exe file:

```
import win32api

def get_version(filename):
    info = win32api.GetFileVersionInfo(filename, "\\")
    ms = info['ProductVersionMS']
    ls = info['ProductVersionLS']
    return win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls)

if __name__ == '__main__':
    print ".".join([str (i) for i in get_version(r"C:\Program Files\Mozilla Firefox\firefox.exe")])

```
Try the following code snippet:

```
import os
firefox_version = os.popen("firefox --version").read()

```