Created
July 23, 2014 21:32
-
-
Save tfaris/ff8c828229ce30fbd65d to your computer and use it in GitHub Desktop.
Get value of __version__ attribute from a python module file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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