Python re.findall assist in writing code
<p>The assignment is to read through the file extracting all of the numbers from the text file, have them in a list, and get a sum of the numbers. Here is the code I have written, which doesn’t work. I know it has to do with the line after <code>re.findall</code> </p>

<pre><code>import re

handle=open('regex_sum_42.txt')

mylist=[]

for lines in handle:

    numbers=re.findall('([0-9]+)',lines)

    if len(numbers)&gt;0:

        #print numbers

sum=0

for numbers in numlist:

    print sum(numlist)
</code></pre>