That's a short, abridged version of my code :) But, what I want is to count total# of keywords per line and print 'em. Rather than printing :
The word 'and' belongs in line num: 1 The word 'del' belongs in line num: 1 The word 'from' belongs in line num: 1 I want to print " Line #1 has 3 keywords" ;) > You probably want something that goes a little like this: > > for i,line in enumerate(linelist): > for k in line.split(): > if keyword.iskeyword(k): > total += line.count(k) > print "The word '%s' belongs in line num: %d" % (k, i+1) > > print "Total keyords are: %d" % total > > James -- http://mail.python.org/mailman/listinfo/python-list