Created
February 2, 2015 13:16
-
-
Save alekseygenerozov/c08b3758e635a3f38811 to your computer and use it in GitHub Desktop.
regexp float search
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
def parse_file_beta(f, string=False): | |
refloat =r'[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?' | |
pat=re.compile('beta_'+refloat) | |
b=re.search(pat,f) | |
b=re.search(refloat, b.group(0)) | |
return b.group(0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment