Skip to content

Instantly share code, notes, and snippets.

@thomasjk10
Created October 5, 2016 05:55
Show Gist options
  • Save thomasjk10/f9cc6969068ad46bfae1445845a15870 to your computer and use it in GitHub Desktop.
Save thomasjk10/f9cc6969068ad46bfae1445845a15870 to your computer and use it in GitHub Desktop.
Regular expressions extraction
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