I have a simple program which looks through a file, finds any numbers inside, and adds them up into a variable called running_total. My issue seems to be that my file name is the thing that is being read instead of its contents.
import re
file = input('Enter file name:')
open(file)
print(file)
running_total = None
for line in file:
line = line.rstrip()
numbers = re.findall("[0-9]+", line)
print(numbers)
for number in numbers:
running_total += float(number)
print(running_total)
What am I missing?