Re: [Tutor] handling a textfile continued

2009-08-20 Thread Douglas Philips
Hi! Hi! There's three first rows that belong to the same subject. And then next three rows belong to another subject and so on, to the end of the file. Thanks for clarifying, you're input comes in lines, and the lines are grouped in threes. What I need to do, is put the three rows tha

Re: [Tutor] handling a textfile continued

2009-08-20 Thread Luke Paireepinart
What have you tried so far and why hasn't it worked? We prefer not to just give solutions. On Thu, Aug 20, 2009 at 1:06 AM, Olli Virta wrote: > Hi! > > Sorry. OK I admit I might have been confusing. Although I got some good > ideas from the messages. Thanks. > > Let me try again: > > So I got th

[Tutor] handling a textfile continued

2009-08-19 Thread Olli Virta
Hi! Sorry. OK I admit I might have been confusing. Although I got some good ideas from the messages. Thanks. Let me try again: So I got this big textfile. It's full of data from a database. About 200 or more rows or lines in a textfile. There's three first rows that belong to the same subject. A

Re: [Tutor] handling a textfile

2009-08-19 Thread Dave Angel
Alan Gauld wrote: "Olli Virta" wrote I have a textfile (job.txt) that needs modifying. The structure of this file is like this: AAA1... BBB1... CCC1... AAA2... BBB2... CCC2... etc... Question is how can I turn this all to a textfile (done.txt) that is suppose to look like this: AAA1...BB

Re: [Tutor] handling a textfile

2009-08-19 Thread Kent Johnson
On Wed, Aug 19, 2009 at 5:54 AM, Alan Gauld 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 nee

Re: [Tutor] handling a textfile

2009-08-19 Thread Alan Gauld
"Olli Virta" wrote I have a textfile (job.txt) that needs modifying. The structure of this file is like this: AAA1... BBB1... CCC1... AAA2... BBB2... CCC2... etc... Question is how can I turn this all to a textfile (done.txt) that is suppose to look like this: AAA1...BBB1...CCC1... AAA2..

Re: [Tutor] handling a textfile

2009-08-19 Thread Fidel Sanchez-Bueno
Olli Virta escribió: Hi! I have a textfile (job.txt) that needs modifying. The structure of this file is like this: AAA1... BBB1... CCC1... AAA2... BBB2... CCC2... etc... Question is how can I turn this all to a textfile (done.txt) that is suppose to look like this: AAA1...BBB1...C

[Tutor] handling a textfile

2009-08-19 Thread Olli Virta
Hi! I have a textfile (job.txt) that needs modifying. The structure of this file is like this: AAA1... BBB1... CCC1... AAA2... BBB2... CCC2... etc... Question is how can I turn this all to a textfile (done.txt) that is suppose to look like this: AAA1...BBB1...CCC1... AAA2...BBB2...CCC2... etc