Andy andy.rockford at
Mon Apr 30 03:24:49 CEST 2007

I pretty doubt about this - "c = line.count(k)" I 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)

print "Total keyords are: %d" % total

More information about the Python-list mailing list