title: compare two text files and output the difference + the name of the file the record was found in
body: <p>Hello I wrote a script that compares two text files and outputs the difference into a separate text file (difference.txt). My goal is to have the name of the file the records were taken from either at the beginning of each row or end of each row before moving onto the next row in my difference.txt.</p>
  
  <p>My script is fairly straightforward:</p>
  
  <pre><code>Jan = "JanFile.txt"
  Feb = "FebFile.txt"
  rootFolder = os.path.dirname(os.path.abspath(__file__))
  
  with open (Jan, "rt") as doc1, open(Feb, "rt") as doc2:
      prevMonth = set(doc1.readlines())
      currentMonth = set(doc2.readlines())
  
  with open ('TxtDiff.txt', 'wt') as unmatchedFile:
      line = (currentMonth - prevMonth)
      unmatchedFile.writelines(line)
  </code></pre>
  
  <p>Just to reiterate: I would like to know which file the records came from in the difference.txt file. Is there anyway to append this information so it appears either before or after the row</p>
  
  <p>Ex:</p>
  
  <p><strong>JanFile would look like:</strong></p>
  
  <pre><code>Column1 | Column2
  Data1   | Data2
  </code></pre>
  
  <p><strong>FebFile would look like:</strong></p>
  
  <pre><code>Column1 | Column2
  Data1   | Data2
  </code></pre>
  
  <p><strong>Difference.txt would look like:</strong> </p>
  
  <pre><code>Column1 | Column2 | Column3
  JanFile | Data1   | Data2
  FebFile | Data1   | Data2
  FebFile | Data1   | Data2
  JanFile | Data1   | Data2
  </code></pre>
  
  <p>I am pretty adamant about using the 
  line = (currentMonth - prevMonth) as using diff, pandas, xlrd, etc has created many other problems.</p>
  
  <p>Any help on this issue would be greatly appreciated.
  Thank you </p>