Created
October 5, 2016 05:55
-
-
Save thomasjk10/f9cc6969068ad46bfae1445845a15870 to your computer and use it in GitHub Desktop.
Regular expressions extraction
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 | |
input = raw_input('Enter file' ) | |
in_fil = open(input) | |
for line in f: | |
line = line.strip() | |
get_num = re.findall('[0-9]+', line) | |
for num in get_num: | |
sum_num = sum_num + int(num) | |
print sum_num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment