You can use f.read() to read the entire file's contents into a string,
providing the file isn't huge. Then, split on "\r" and replace "\n"
when found.
A simple test:
input_data = "abc\rdef\rghi\r\njkl\r\nmno\r\n"
first_split = input_data.split("\r")
for rec in first_split:
rec = rec.replace("\
On Wed, Aug 31, 2011 at 12:37 PM, Alex van der Spek wrote:
> I have a text file that uses both '\r' and '\r\n' end-of-line terminations.
>
> The '\r' terminates the first 25 lines or so, the remainder is termiated
> with '\r\n'
> Is there a way to make it read one line at a time, regardless of th
I have a text file that uses both '\r' and '\r\n' end-of-line terminations.
The '\r' terminates the first 25 lines or so, the remainder is termiated
with '\r\n'
Reading this file like this:
for line in open(filename,'r'):
line= #Do whatever needs doing...
The first line