Let's say I have two files, file1.txt, file2.txt.
file1.txt is the following
TITLE   MEARA Repeatv2 Run2 
DATA TYPE       
ORIGIN  JASCO   
OWNER       
DATE    18/03/08    
TIME    22:07:45    
SPECTROMETER/DATA SYSTEM    JASCO Corp., J-715, Rev. 1.00   
RESOLUTION      
DELTAX  -0.1    
XUNITS  NANOMETERS  
YUNITS  CD[mdeg]    
    HT[V]   
FIRSTX  260 
LASTX   200 
NPOINTS 601 
FIRSTY  -4.70495    
MAXY    -4.70277    
MINY    -41.82113   
XYDATA      
260.0   -4.70495    443.669
259.9   -4.70277    443.672
259.8   -4.70929    443.674
259.7   -4.72508    443.681
259.6   -4.72720    443.69
file2.txt is this:
TITLE   MEARA Repeatv2 Run2 
DATA TYPE       
ORIGIN  JASCO   
OWNER       
DATE    18/03/08    
TIME    22:30:34    
SPECTROMETER/DATA SYSTEM    JASCO Corp., J-715, Rev. 1.00   
RESOLUTION      
DELTAX  -0.1    
XUNITS  NANOMETERS  
YUNITS  CD[mdeg]    
    HT[V]   
FIRSTX  260 
LASTX   200 
NPOINTS 601 
FIRSTY  -4.76564    
MAXY    -3.51295    
MINY    -41.95971   
XYDATA      
260 -4.76564    443.152
259.9   -4.77382    443.155
259.8   -4.78663    443.156
259.7   -4.8017 443.162
259.6   -4.83604    443.174
I have written the following Python script to concatenate the two files.
def catFiles(names, outName):
    with open(outName, 'w') as outfile:
        for fname in names:
            fileName=('/'+str(fname))
            with open(fname) as infile:
                outfile.write(infile.read())
while this script works to concatenate the two files, it stacks the files on top of each other, so that one file comes after another. I was wondering how I can modify this or rewrite it, such that the files are stacked next to each other; such that I get the following output
TITLE   MEARA Repeatv2 Run2     TITLE   MEARA Repeatv2 Run2 
DATA TYPE           DATA TYPE       
ORIGIN  JASCO       ORIGIN  JASCO   
OWNER           OWNER       
DATE    18/03/08        DATE    18/03/08    
TIME    22:07:45        TIME    22:30:34    
SPECTROMETER/DATA SYSTEM    JASCO Corp., J-715, Rev. 1.00       SPECTROMETER/DATA SYSTEM    JASCO Corp., J-715, Rev. 1.00   
RESOLUTION          RESOLUTION      
DELTAX  -0.1        DELTAX  -0.1    
XUNITS  NANOMETERS      XUNITS  NANOMETERS  
YUNITS  CD[mdeg]        YUNITS  CD[mdeg]    
    HT[V]           HT[V]   
FIRSTX  260     FIRSTX  260 
LASTX   200     LASTX   200 
NPOINTS 601     NPOINTS 601 
FIRSTY  -4.70495        FIRSTY  -4.76564    
MAXY    -4.70277        MAXY    -3.51295    
MINY    -41.82113       MINY    -41.95971   
XYDATA          XYDATA      
260.0   -4.70495    443.669 260.0   -4.76564    443.152
259.9   -4.70277    443.672 259.9   -4.77382    443.155
259.8   -4.70929    443.674 259.8   -4.78663    443.156
259.7   -4.72508    443.681 259.7   -4.80170    443.162
259.6   -4.72720    443.690 259.6   -4.83604    443.174


pastewhich does exactly this. Of course, this is not a solution in Python, though.