> > Are repeated newlines/carriage returns significant at all? What about > just using re and just replacing any repeated instances of '\r' or '\n' > with '\n'? I.e. something like > >>> # the_string is your file all read in > >>> import re > >>> re.sub("[\r\n]+", "\n", the_string) > and then continuing as before (i.e. splitting by newlines, etc.) > Does that work? > Cheers, > Thomas
The '\r\r\n' string is a line separator, though not used consistently in US meteorological bulletins. I do not want to eliminate "real" empty lines. I was hoping there is a way to prevent read() from making hidden changes to the file content. George -- https://mail.python.org/mailman/listinfo/python-list