471,305 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 software developers and data experts.

csv module usage in w2k -> lineterminator in dialect?

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
1 2012

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.

Similar topics

6 posts views Thread by sj | last post: by
4 posts views Thread by Brad Tilley | last post: by
4 posts views Thread by Brad Parks | last post: by
reply views Thread by Crutcher | last post: by
1 post views Thread by alain MONTMORY | last post: by
32 posts views Thread by Matias Jansson | last post: by
40 posts views Thread by rjcarr | last post: by
2 posts views Thread by Anish Chapagain | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.