Last active
December 11, 2015 20:59
-
-
Save tombrad/4659341 to your computer and use it in GitHub Desktop.
aprenda pyton en 3 dias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
colon=":" | |
count=0 | |
total=0 | |
fname = raw_input("Enter file name: ") | |
fh = open(fname) | |
for line in fh: | |
if not line.startswith("X-DSPAM-Confidence:") : continue | |
pos = line.find(colon) | |
pos=int(pos) | |
num=line[pos+1:40] | |
num=float(num) | |
count=count+1 | |
total=total+num | |
print "Average spam confidence:", total/count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment