Simple I/O problem can't get solved

Chris Angelico rosuav at gmail.com
Sat Jun 22 05:07:59 EDT 2013


On Fri, Jun 21, 2013 at 7:15 PM, Peter Otten <__peter__ at web.de> wrote:
> Combining these modifications:
>
> for line in f:
>     word = line.strip()
>     if is_palindrome.is_palindrome(word):
>         print word

Minor quibble: I wouldn't use the name 'word' here, unless you're
expecting the file to consist of one-word lines (such as DICTOT.DIC
from old PMMail). For detecting phrase/sentence palindromes, I'd keep
the name 'line'.

ChrisA



More information about the Python-list mailing list