[Tutor] handling a textfile

Kent Johnson kent37 at tds.net
Wed Aug 19 13:57:30 CEST 2009


On Wed, Aug 19, 2009 at 5:54 AM, Alan Gauld<alan.gauld at btinternet.com> wrote:

> Lots of ways to do it. The simplest is to read the variables line by line,
> so, in pseudo code:
>
> while infile not empty
>    a = f.readline()
>    b = f.readline()
>    c = f.readline()
>    outfile.write("%s,%s,%s" % (a,b,c) )

You will need to strip newlines from a and b.

Kent


More information about the Tutor mailing list