Skip to content

Instantly share code, notes, and snippets.

@thomasjk10
Last active September 21, 2016 15:53
Show Gist options
  • Save thomasjk10/512d4f14cbd203f1819d3498797e23fd to your computer and use it in GitHub Desktop.
Save thomasjk10/512d4f14cbd203f1819d3498797e23fd to your computer and use it in GitHub Desktop.
Subject: [sakai] svn commit: r39772 - content/branches/sakai_2-5-x/content-impl/impl/src/java/org/sakaiproject/content/impl
X-Content-Type-Outer-Envelope: text/plain; charset=UTF-8
X-Content-Type-Message-Body: text/plain; charset=UTF-8
Content-Type: text/plain; charset=UTF-8
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Sat Jan 5 09:14:16 2008
X-DSPAM-Confidence: 0.8475
X-DSPAM-Probability: 0.0000
# Use the file name mbox-short.txt as the file name
fname = raw_input("Enter file name: ")
fh = open(fname)
fr = fh.read()
fs = fr.strip()
sum_conf = 0
count = 0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") :
continue
check = fs.find(' ')
extr = fs[check:]
val = float(extr)
count = count + 1
sum_conf = sum_conf + val
print "Average spam confidence: ", sum_conf/count
@thomasjk10
Copy link
Author

Please let me know if there are issues in this code. I currently see a 'Divide by Zero' Error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment