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 text = open('text_numbers.txt') data=text.read() print sum(map(int,re.findall(r"\b\d+\b",data)))
Use .read to get content in string format
.read
string