Python - Readline and compare
<p>Im trying to create a function which reads each line in a file and compares the words with their reverse (palindrome) version <code>i.e &gt; (heheh = heheh) &amp; (law = wal)</code>. So when i tried to do that the condition has failed and the function returned an empty list.</p>

<p><strong>CODE</strong></p>

<pre><code>def palindrome_lst():
    lst = []
    with open("words.txt", "r") as f:
        for line in f:
            if line == line[::-1]:
                lst.append(line)
    return lst

print palindrome_lst()
</code></pre>