Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions week8/Assignment 8.5.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
#cwen@iupui.edu
#There were 27 lines in the file with From as the first word

fname = raw_input("Enter file name: ")
fname = input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"

fh = open(fname)
count = 0
c = 0
l = [i.split() for i in fh.readlines()
if i.startswith("From") and i.find("@")>0 and len(i.split())>2]
for i in l:
print i[1]
count+=1
print "There were", count, "lines in the file with From as the first word"
c+=1
print("There were", c, "lines in the file with From as the first word")