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("\n", "") print rec -- http://mail.python.org/mailman/listinfo/python-list
- Text file with mixed end-of-line terminations Alex van der Spek
- Re: Text file with mixed end-of-line terminations Chris Rebert
- Re: Text file with mixed end-of-line terminations woooee