Archived
1
0
Fork 0
This repository has been archived on 2024-05-10. You can view files and clone it, but cannot push or open issues or pull requests.
PY4E/Assignment 7.2/main.py
2021-09-08 10:33:48 -05:00

18 lines
411 B
Python

# Use the file name mbox-short.txt as the file name
#fn = input("File Name: ")
fn = "mbox-short.txt"
fh = open(fn)
count = 0
confidence = 0
for line in fh:
if line.startswith("X-DSPAM-Confidence:"):
score = line.find("0")
score = float(line[score:])
count = count + 1
confidence = confidence + score
print ("Average spam confidence:", confidence / count)