title: How to diff the two files using Python Generator
body: <p>I have one file of 100GB having 1 to 1000000000000 separated by new line. In this some lines are missing like 5, 11, 19919 etc. My Ram size is 8GB.</p>
  
  <p>How to find the missing elements.</p>
  
  <p>My idea take another file <code>for i in range(1,1000000000000)</code> read the lines one by one using the <strong>generator</strong>. can we use <strong>yield</strong> statement for this</p>
  
  <p>Can help in writing the code</p>
  
  <p>My Code, the below code taking as a list in does the below code can use it for production.?</p>
  
  <pre><code>def difference(a,b):
      with open(a,'r') as f:
          aunique=set(f.readlines())
  
  
      with open(b,'r') as f:
          bunique=set(f.readlines())
  
      with open('c','a+') as f:
          for line in list(bunique - aunique):
              f.write(line)
  </code></pre>