> What you want is something like: > > for line in inp: > lines +=1 > # a list of words > tempwords = line.split() > for k in tempwords: > if keyword.iskeyword(k): > print tempwords
I think it should be: if keyword.iskeyword(k): print k -- http://mail.python.org/mailman/listinfo/python-list