> The problem is when I get to the last line. When the program sees '\n'
> after the 9, everything works fine. However, when there isn't a '\n',
> the program doesn't process the last line.
>
> What would be the best approach to handle the case of the possible
> missing '\n' at the end of the file?

use readines to read all lines into a list and then iterate thru the
list:

f = open(r'c:\test.txt', 'rb')
print f.readlines()

>>
['1\r\n', '3\r\n', '5\r\n', '7\r\n', '3\r\n', '9']
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to