title: Python program to compare two files for showing the difference
body: <p>I have the following code to compare two files. I would like this program run if I point them to files which are as big as 4 or 5 MB. When I do that, the prompt cursor in python console just blinks, and no output is shown. Once, I ran it for the whole night and the next morning it was still blinking. What can I change in this code?</p>
  
  <pre><code>import difflib
  
  file1 = open('/home/michel/Documents/first.csv', 'r')
  file2 = open('/home/michel/Documents/second.csv', 'r')
  
  diff = difflib.ndiff(file1.readlines(), file2.readlines())
  delta = ''.join(diff)
  print delta
  </code></pre>