fname = input('Enter file name: ')
f = open(fname)
val_list = []
tot = 0
line_cnt = 0
for line in f:
    a = re.findall('X-DSPAM-Confidence:\\s*(\\d+\\.?\\d*)', line)
if len(a) != 0:
    tot += float(a[0])
line_cnt += 1
print(('Line Count is ', line_cnt))
print(('Average is ', tot / line_cnt))
f.close()
I am learning Python, need some pushing in the right direction