I am just learning python and need some help for my class assignment.
I have a file with text and numbers in it. Some lines have from one to three numbers and other
import re fl=open('regex_sum_7469.txt') ls=[] for x in fl: #create a list in the list x=x.rstrip() print x t= re.findall('[0-9]+',x) #all numbers for d in t: #for loop as there a empthy values in the list a ls.append(int(d)) print (sum(ls))