When working with files, please do this
with open('out_file', 'w') as outf:
with open('file_1', 'r') as in1:
for line in in1:
s = line.split('\t')
a = s[1][:-1]
b = s[0]
counter = 0
with open('file_2', 'r') as in2:
for line in in2:
etc.
Using with
assures your files are closed.
Opening a file in the smallest enclosing scope guarantees it can be read all the way through. It's costly to keep reopening the file, but there are a lot of ways to speed up this application.
Also, please use only lowercase
variable names. Reserve Uppercase
for class names.