[Tutor] Writing an "Alt-Enter"

John Fouhy john at fouhy.net
Tue Jun 20 07:13:46 CEST 2006


On 20/06/06, URBAN LANDREMAN <ulandreman at msn.com> wrote:
> I'm trying to write a .csv file which I can subsequently load into Excel.
> The part that's tripping me up is I want to include an "Alt-Enter" between
> two of the fields so that when Excel reads the file, it will enter the two
> fields into the same cell, but on separate lines.

Hi,

You could try printing a carriage return: '\r'.

But, also --- have you looked into the csv module?  It's designed for
writing (and reading) csv files, and it knows about Excel.  It might
be that you can feed it strings with newlines in them and it will
produce the output you want.

-- 
John.


More information about the Tutor mailing list