Re: [Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Alan Gauld
On 22/11/11 18:50, Mayo Adams wrote: for item in tuplelist outputfile.write (item) doesn't work, and I suppose I scarcely expect it should, but I am at a loss to find out how to do it. You need to convert the tuple to a string. And you need to add a newline at the end. A simple w

Re: [Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Hugo Arts
On Tue, Nov 22, 2011 at 7:50 PM, Mayo Adams wrote: > I have a list of tuples of the form (string,integer) that I would like to > write  to  a file with a line break between each. Simply writing to a file > object thus > > for item in tuplelist >    outputfile.write (item) > > doesn't work,

[Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Mayo Adams
I have a list of tuples of the form (string,integer) that I would like to write to a file with a line break between each. Simply writing to a file object thus for item in tuplelist outputfile.write (item) doesn't work, and I suppose I scarcely expect it should, but I am at a loss to