title: python Add values to file in new column if they match
body: <p>I know this should be simple, but as I am new in python, I've been having some problems adding values and columns to a file. I have two files and I want to find line that match, if a line match I want a new column with value 1 and if the don't match the should get 0. This should be written in file-1 or in outPut. I have problem with adding the values.</p>
  
  <p>Here my code until now:</p>
  
  <pre><code># -*- coding: utf8 -*-
  
  f1 = open('text-1.txt', 'r')
  f2 = open('text-2.txt', 'r')
  
  fileOne= f1.readlines()
  fileTwo = f2.readlines()
  
  outPut = open('output.txt', 'w')
  
  for x,y in zip(fileOne,fileTwo):
      if x==y:
          outPut.write("\t".join(x) + 1)
  
      else:
          outPut.write("\t".join(x) + 0)
  
  
  f1.close()
  f2.close()
  outPut.close
  </code></pre>
  
  <p>Any suggestions or is there an easier way to do this?</p>
  
  <p>Thanks</p>