input1, input2, output are tab-delimited txt files.
If input1 is
a b c
1 2 3
and input2 is
e r t
then I would want output to be
a b c
1 2 3
e r t
I tried to concatenate files using python by learning from Python concatenate text files
I tried
filenames = ['input1.txt', 'input2.txt']
with open('output.txt', 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
for line in infile:
outfile.write(line)
and then tried
filenames = ['input1.txt', 'input2.txt']
import fileinput
with open('output.txt', 'w') as fout:
for line in fileinput.input(filenames):
fout.write(line)
But both codes concatenate files horizontally, not vertically.
The codes create this:
a b c
1 2 3e r t