title: Python - How to compare two files and output only the different lines in a third file
body: <p>I have searched for similar questions on SO but didn't find anything that worked for me.  </p>
  
  <p>I have two large files, they should be the same but one of the files is 60 lines longer than the other. I want to know what these lines are and where I can find them.   </p>
  
  <p>I've read that one can use difflib to do this but I can't figure out how to go about it. I always get <code>+</code> and <code>-</code> in the file but I don't want that. I just want to scan through both files and report the uncommon 60 lines into a third file. </p>
  
  <p>I wrote this code but it does not print out the different lines.</p>
  
  <pre><code>f1 = open('file1.txt','r')
  f2 = open('file2.txt','r')
  f3 = open('file3.txt','w')
  
  diff = set(f1).difference(f2)
  same.discard('\n')
  
  for line in same:
      f3.write(line)
  </code></pre>