[Tutor] Difficulty with csv files - line breaks

Albert Sweigart asweigart at gmail.com
Wed Nov 25 00:01:38 CET 2009


Tim,

I've checked your code and it seems to work as far as using newlines
for the line terminator. The default line terminator is \r\n, which
might not show up correctly in some text editors.

Otherwise, try checking to see if you've specified a blank line for
the line terminator. You can set it explicitly when you create your
csv.writer:

writer = csv.writer(text_file, quoting=csv.QUOTE_NONNUMERIC,
lineterminator='\r\n')


-Al
You should check out my free beginner's Python book here:
http://inventwithpython.com


More information about the Tutor mailing list