By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,597 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

csv module usage in w2k -> lineterminator in dialect?

P: n/a
Hi,

I have a question regarding csv module usage in W2K
(ActivePython-2.3.2-232-win32-ix86)

http://www.python.org/doc/current/li...mt-params.html says:
"lineterminator
The string used to terminate lines in the CSV file. It defaults to
'\r\n'."

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

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'?

thanks,

-Teuvo

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

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

Make sure you open the file with the 'b' flag.

Skip

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.