csv module usage in w2k -> lineterminator in dialect?

Teuvo Eloranta teeloranTakeThisAway at sunpoint.net
Thu Feb 5 10:23:34 CET 2004


I have a question regarding csv module usage in W2K

http://www.python.org/doc/current/lib/csv-fmt-params.html says:
     The string used to terminate lines in the CSV file. It defaults to

If I use:
lineterminator = '\n' in the dialect
the file ends get's generated in hex: 0D OA  (Carriadge return, new

but if I use:
lineterminator = '\r\n' or the ready-made excel dialect, dialect='excel'

I get the file ends in hex: 0D 0D 0A
--> When Excel reads CSV file, every other line is empty.

Windows uses OD OA in the line end in text files, so shouldn't the
module produce it if set:
lineterminator = '\r\n', not lineterminator = '\n'?



More information about the Python-list mailing list