The simplest approach is probably to replace your first line with something like this:
words = [x.strip() for x in line.split('\t')]
This is a list comprehension, taking each element of the list returned by line.split('\t')
, stripping it, and adding it to a new list.