Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. # Use the file name mbox-short.txt as the file name
  2. fname = raw_input("Enter file name: ")
  3. fh = open('mbox-short.txt','r')
  4. count = 0
  5. total = 0
  6. for line in fh:
  7. if not line.startswith("X-DSPAM-Confidence:") : continue
  8. count = count + 1
  9. num = float(line[20:])
  10. total = total + num
  11. average = total/count
  12.  
  13.  
  14. print "Average spam confidence:" + " " + str(average)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement