title: How to find the difference between two lists of dictionaries checking the key-value pair
body: <p>I've already searched for a solution to my problem but with no success. Part of the solution for my problem is <a href="https://stackoverflow.com/questions/25552972/how-to-find-the-difference-between-two-lists-of-dictionaries">here</a>, but this does not solve it all.</p>
  
  <p>I have two lists of dictionaries like this - each dictionary is written to a csv file but I read the contents to the following variables:</p>
  
  <pre><code>list1 = [{a:1, b:2, c:3}, {a:4, b:5, c:6}, {a:7, b:8, c:9}]
  list2 = [{b:2, a:1, c:3}, {c:6, b:5, a:4}, {b:8, a:7, c:9}]
  </code></pre>
  
  <p>Using the solution of the link above, ie:</p>
  
  <pre><code>&gt;&gt;&gt; import itertools
  
  &gt;&gt;&gt; a = [{'a': '1'}, {'c': '2'}]
  &gt;&gt;&gt; b = [{'a': '1'}, {'b': '2'}]
  &gt;&gt;&gt; intersec = [item for item in a if item in b]
  &gt;&gt;&gt; sym_diff = [item for item in itertools.chain(a,b) if item not in intersec]
  </code></pre>
  
  <p>I get no matches because the order of the dictionary is different. But in fact, both lists are the same. How can I check this? Do I have to sort the dictionaries before writing them to the csv file? Can this be a solution?</p>
  
  <p>This is my major problem at the moment but I have another issue also. It would be great to be able to make this match check but ignoring one or more keys defined by me. Is this also possible?</p>
  
  <p><strong>EDIT: I have the dicitonaries in a csv file and I'm reading them with the following code:</strong></p>
  
  <pre><code>def read_csv_file(self, filename):
      '''Read CSV file and return its content as a Python list.'''
      f = open(filename, 'r')
      csvfile = csv.reader(f)
      f.close
      return [row for row in csvfile]
  </code></pre>
  
  <p>This is very important because I think the problem is that after reading the values from the csv it's not dictionaries anymore, so the order has to be the same.</p>
  
  <p><strong>EDIT2: sample of the csv file (3 lines, it's creating an empty line but that's not an issue...)</strong></p>
  
  <pre><code>"{u'Deletion': '0', u'Source': 'Not Applicable', u'Status': ''}"
  
  "{u'Deletion': '0', u'Source': 'Not Applicable', u'Status': ''}"
  </code></pre>