Skip to content

Instantly share code, notes, and snippets.

@tfaris
Created July 23, 2014 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfaris/ff8c828229ce30fbd65d to your computer and use it in GitHub Desktop.
Save tfaris/ff8c828229ce30fbd65d to your computer and use it in GitHub Desktop.
Get value of __version__ attribute from a python module file
import re
s = open('C:/ProgramData/Nichevision Forensics/ArmedXpert/plugins/reports/mixture_combinations_report.py').read()
m = re.search('__version__\s*=(.*)\s?', s)
if m.groups():
v = m.groups()[0].replace("'", "").replace('"', '').strip()
print v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment