"nitin chandra" <[email protected]> wrote in message news:[email protected]...
Hello All,

I am trying to read from 2 CSV files, where first 4 ([0,1,2,3])
columns are read from 'file1' and 3 columns ([1,2,3]) from 'file2' and
write them into a 3rd file 'file3', 7 columns string. The data is
Numeric values both, +ve and -ve.

The data types should be irrelevant since it is all strings in the file.
But reading your requirement you want something like:

while nTrue
 try:
   line1A = file1.readline()
   line1B = file2.readline()
   file3.write(line1A + line1B)
 except IOError:
     reached end of one of the files,
     figure out how to handle it...

That looks like it should be simpler than the code you posted...


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to