James - I pretty doubt about this - "c = line.count(k)" You might wanna recheck on that. ------------------------------------------------ I think it would be obvious how to write this:
for i,line in enumerate(linelist): line = line.split() for k in line: if keyword.iskeyword(k): c = line.count(k) total += line.count(k) print "Line #%d has %d keywords." % (i+1, c) break print "Total keyords are: %d" % total > > I think it would be obvious how to write this: > > for i,line in enumerate(linelist): > line = line.split() > for k in line: > if keyword.iskeyword(k): > c = line.count(k) > total += line.count(k) > print "Line #%d has %d keywords." % (i+1, c) > break > > print "Total keyords are: %d" % total -- http://mail.python.org/mailman/listinfo/python-list