Not able to read blank lines and spaces on a small text file
peter at engcorp.com
Mon Sep 13 17:09:11 CEST 2004
Peter Hickman wrote:
> Ruben wrote:
>> I am trying to read a small text file using the readline statement. I
>> can only read the first 2 records from the file. It stops at the blank
>> lines or at lines with only spaces. I have a while statement checking
>> for an empty string "" which I understand represents an EOF in Python.
>> The text file has some blank lines with spaces and other with blanks.
> My brain is not really working but a blank line is not how python
> processes a the EOF.
Actually, it is when using things like .readline(), which return even
the newline \n at the end of the line...
More information about the Python-list