> Date: Tue, 24 Nov 2009 15:01:38 -0800 > From: Albert Sweigart <asweig...@gmail.com> > To: tutor@python.org > Subject: Re: [Tutor] Difficulty with csv files - line breaks > Message-ID: > <716dd5b60911241501y57db5c62r358b1a9859a3a...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > 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 > > > ------------------------------
Al, That helped out a lot. I had worked around this problem by writing a "\n" after writing the csv information. text_file.write("\n") Setting the lineterminator explicitly fixes it and cleans up my code. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor