title: Python compare differences - part 2
body: <p>I have asked a similar question like this before but I am going to try again because I have some more questions.</p>
  
  <p>I have two csv files that have 3 columns. </p>
  
  <p>Name    Product    Amount:</p>
  
  <p>I want to get the differences between the two files. I can do this if the two files are in the same order of name and product. This will give me the differences of amount which is what I am looking for.</p>
  
  <p>I am needing to have something that will take to list and compare the two and show differences if not in same order.</p>
  
  <p>I have tried:</p>
  
  <pre><code>import csv
  import difflib 
  
  
  file1 = open('file1','rb').read().splitlines()
  file2 = open('file1','rb').read().splitlines()
  
  for diff in difflib.ndiff(file1, file2):
      print(diff)
  </code></pre>
  
  <p>But if any thing is out of order no good. Is there a way I can group each "name product amount" and compare to file 2 where I have grouped each "name product amount", and if there is a difference between file 1 and file 2 show that. </p>