Im trying to read 3 text files and combine them into a single output file. so far so good, the only problem is that I need to create columns for every file i read. right now I have all the extracted data from the files in a single column.
#!/usr/bin/env python
import sys
usage = 'Usage: %s infile' % sys.argv[0]
i=3 #start position
outfile = open('outfil.txt','w')
while i<len(sys.argv):
try:
infilename = sys.argv[i]
ifile = open(infilename, 'r')
outfile.write(infilename+'\n')
for line in ifile:
outfile.write(line)
print line
except:
print usage; sys.exit[i]
i+=1;
right now my output file looks like this:
test1.txt
a
b
c
d
test2.txt
e
f
g
h
test3.txt
i
j
k
l