I am trying to get my python script to read a text file with a list of file names with extensions and print out when it finds a particular extension (.txt files to be exact). It
Each line ends with a new line character '\n' so the test will rightly fail. So you should strip the line first then test:
'\n'
strip
line.rstrip().endswith('.txt') # ^