diff --git a/week7/Assignment 7.2.py~ b/week7/Assignment 7.2.py~ index d43d306..70c7514 100644 --- a/week7/Assignment 7.2.py~ +++ b/week7/Assignment 7.2.py~ @@ -12,16 +12,16 @@ You can download the sample data at http://www.pythonlearn.com/code/mbox-short.t #Average spam confidence: 0.750718518519 # Use the file name mbox-short.txt as the file name -fname = raw_input("Enter file name: ") +fname = input("Enter file name: ") fh = open(fname) l = [] -for line in fh: - if not line.startswith("X-DSPAM-Confidence:") : continue - ll = line.split() +for x in fh: + if not x.startswith("X-DSPAM-Confidence:") : continue + ll = x.split() for i in ll: try: u = float(i) l.append(u) except: pass -print "Average spam confidence:",sum(l)/len(l) +print("Average spam confidence:",sum(l)/len(l))