osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The file method read does not "see" CR


I am running Python 2.7.10 on a Windows 10 machine. I have written a Python
program that counts occurrences of bytes in a text file and have run it on
a small test file. This file has CR-LF sequences at the ends of its lines.
The Python program counted the LF bytes, but didn't count any CR bytes.
Given that the documentation for the read method claims that exactly size
bytes are read by each call to the method (in this case, size is 1) does
this behaviour constitute a bug?

Stephen Tucker.