[Tutor] write list to columns

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Apr 12 16:32:18 CEST 2012

On 12/04/2012 08:48, Alan Gauld wrote:
> On 12/04/12 03:31, questions anon wrote:
>> I am trying to simply write a list of values to txt file in one column.
>> I would then like to add another list in a second column.
> That's going to be quite awkward to do. Files like to be written one
> complete line at a time. The normal approach would be to build up the
> table structure in memory and then write the entire table out in one go.
> If it won't fit in memory use a simple database like SQLite to build the
> table then print that out row by row.

Built-in zip? Or have I missed something?

>> Somehow they only appear as one long row.
> You need to write newlines but you probably also want to use string
> formatting to control the amount of space required so that your columns
> line up.


Mark Lawrence.

More information about the Tutor mailing list