Hello, I am new to daniWeb. I am creating a script but have run into a problem when it comes to printing the line number.
print
for word in words:
word = clearup(word)
if word in dictionary:
pass
else:
print word
On the last line I want to do something like... print word':'linenumber
Would I use something from " from linecache import getline "
I have tried:
linenum = getline(filepath, ##line_number##)
print word.strip('.')
print ' :(',
print linenum
print ')'
It doesn't work and prints Either data about a line of python code (not line number from the text file) or just prints a bunch of Trues... could someone please explain what I need to do?