title: Finding intersection of two lists of strings in python
body: <p>I have gone through <a href="https://stackoverflow.com/questions/642763/python-intersection-of-two-lists">Find intersection of two lists?</a>, <a href="https://stackoverflow.com/questions/12765558/intersection-of-two-lists-of-strings">Intersection of Two Lists Of Strings</a>, <a href="https://stackoverflow.com/questions/27006622/getting-intersection-of-two-lists-in-python">Getting intersection of two lists in python</a>. However, I could not solve this problem of finding intersection between two string lists using Python.</p>
  
  <p>I have two variables.  </p>
  
  <pre><code>A = [['11@N3'], ['23@N0'], ['62@N0'], ['99@N0'], ['47@N7']]
  
  B  = [['23@N0'], ['12@N1']]
  </code></pre>
  
  <p>How to find that '23@N0' is a part of both A and B?</p>
  
  <p>I tried using intersect(a,b) as mentioned in <a href="http://www.saltycrane.com/blog/2008/01/how-to-find-intersection-and-union-of/" rel="noreferrer">http://www.saltycrane.com/blog/2008/01/how-to-find-intersection-and-union-of/</a>
  But, when I try to convert A into set, it throws an error:</p>
  
  <pre><code>File "&lt;stdin&gt;", line 1, in &lt;module&gt; TypeError: unhashable type: 'list'
  </code></pre>
  
  <p>To convert this into a set, I used the method in <a href="https://stackoverflow.com/questions/13464152/typeerror-unhashable-type-list-when-using-built-in-set-function">TypeError: unhashable type: &#39;list&#39; when using built-in set function</a> where the list can be converted using </p>
  
  <pre><code>result = sorted(set(map(tuple, A)), reverse=True)
  </code></pre>
  
  <p>into a tuple and then the tuple can be converted into a set. However, this returns a null set as the intersection.</p>
  
  <p>Can you help me find the intersection?</p>