Skip to content

Instantly share code, notes, and snippets.

@tombrad
Last active December 11, 2015 20:59
Show Gist options
  • Save tombrad/4659341 to your computer and use it in GitHub Desktop.
Save tombrad/4659341 to your computer and use it in GitHub Desktop.
aprenda pyton en 3 dias
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