The file method read does not "see" CR

Stephen Tucker stephen_tucker at sil.org
Tue Dec 10 05:15:45 EST 2019


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.


More information about the Python-list mailing list