title: Reading a string from an opened text file
body: <p>The code below is supposed to iterate over various items in a text file and return true if their first and last characters are the saem. If I use a simple string saved as a variable in the code it works fine. However, as soon as I get it to check the same word from the text file it returns False even though the word is a palindrome. Any help would be appreciated.</p>
  <pre class="lang-py prettyprint-override"><code>def is_palindrome(line):
      if line[0] == line[-1]:        
          return True
      else:
          return False
      
  infile = open('palindrome_input.txt', 'r')
  
  line = infile.readline()
  
  is_palindrome(line)
  </code></pre>