<amr...@iisermohali.ac.in> wrote

but it is priniting second file after first, whereas i want to join them
columwise like:---

FileA  FileB   FileC
12      14     12  14
15  +   16  =  15  16
18      17     18  17
20      19     20  19


I'm not sure what the plus sign in the second line signifies but otherwise it looks like you will need to process each file line by line and concatenate each string.

for line1 in fileA:
    line2 = fileB.readline()
    fileC.write("%s\t%s" % line1,line2)


You might need to strip the lines before writing them...


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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to