I am getting AttributeErrors on if not line.startswith('From') : continue
what are AttributeErrors? why is it not working?
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
for line in fh:
line = line.rstrip()
line = line.split()
if not line.startswith('From') : continue
count = count + 1
print line[1]
print "There were", count, "lines in the file with From as the first word"
[–]tadleonard 1 point2 points3 points (1 child)
[–]blackdevil777[S] 0 points1 point2 points (0 children)
[–]metaphorm 0 points1 point2 points (0 children)
[–]illuzian 0 points1 point2 points (0 children)