[Python-Dev] Re: [Csv] csv module and universal newlines
Jack Jansen
Jack.Jansen at cwi.nl
Thu Jan 13 00:02:39 CET 2005
On 12-jan-05, at 2:59, Skip Montanaro wrote:
> terminators = {"darwin": "\r",
> "win32": "\r\n"}
>
> if (dialect.lineterminator != terminators.get(sys.platform, "\n")
> and
> "b" not in getattr(f, "mode", "b")):
> raise IOError, ("%s not opened in binary mode" %
> getattr(f, "name", "???"))
On MacOSX you really want universal newlines. CSV files produced by
older software (such as AppleWorks) will have \r line terminators, but
lots of other programs will have files with normal \n terminators.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
Goldman
More information about the Csv
mailing list