Not able to read blank lines and spaces on a small text file
Pierre Fortin
pfortin at pfortin.com
Mon Sep 13 11:06:47 EDT 2004
More information about the Python-list mailing list
Mon Sep 13 11:06:47 EDT 2004
- Previous message (by thread): Not able to read blank lines and spaces on a small text file
- Next message (by thread): Not able to read blank lines and spaces on a small text file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 13 Sep 2004 07:48:14 -0700 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. An empty record is not the same as "no record"... Change this: > while record != "": to: while record:
- Previous message (by thread): Not able to read blank lines and spaces on a small text file
- Next message (by thread): Not able to read blank lines and spaces on a small text file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list