Re: The file method read does not "see" CR

2019-12-16 Thread Peter J. Holzer
On 2019-12-10 10:15:45 +, Stephen Tucker wrote: > I am running Python 2.7.10 on a Windows 10 machine. Unless you have a really good reason to stick with Python 2.7, don't: https://pythonclock.org/ The current version of Python is 3.8, and there have been quite a few changes between 2.x and 3.

Re: The file method read does not "see" CR

2019-12-10 Thread Chris Angelico
On Wed, Dec 11, 2019 at 2:18 AM Stephen Tucker wrote: > > Chris, > > Many thanks. The first part of your answer was spot on. I have modified the > program, opening its input file in "rb" mode, and now the program is working > as I intend it to. > Cool! > I am puzzled by the second part, where

Re: The file method read does not "see" CR

2019-12-10 Thread Stephen Tucker
Chris, Many thanks. The first part of your answer was spot on. I have modified the program, opening its input file in "rb" mode, and now the program is working as I intend it to. I am puzzled by the second part, where you say that the read call will return one character, if the file is in text mo

Re: The file method read does not "see" CR

2019-12-10 Thread Chris Angelico
On Tue, Dec 10, 2019 at 9:17 PM Stephen Tucker wrote: > > 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 Pyth

The file method read does not "see" CR

2019-12-10 Thread Stephen Tucker
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. G