Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Use the file name mbox-short.txt as the file name
- fname = raw_input("Enter file name: ")
- fh = open('mbox-short.txt','r')
- count = 0
- total = 0
- for line in fh:
- if not line.startswith("X-DSPAM-Confidence:") : continue
- count = count + 1
- num = float(line[20:])
- total = total + num
- average = total/count
- print "Average spam confidence:" + " " + str(average)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement