title: Finding matches in a Python multi-dimensional list
body: <p>i'm going nuts here with this and i have a deadline. So i have this multi-d list in python:</p>
  
  <pre><code>list_a = [[['a', 'b'],['c', 'd'], ['e', 'CB'], ['g', 'h'], ['a', 'j', 'k']]]
  </code></pre>
  
  <p>Notice, that the whole thing is in 2 brackets.
  I need to compare elements like this: a to c, a to d, b to c, b to d, a to e, a to CB...until the first list has compared all it's items with all the items in the other lists, then it moves on to the second list and starts comparing its items to the rest of the lists and so on till the end. I don't want it to compare its own items to its own list.
  Here's some code:</p>
  
  <pre><code>for i in range(0, len(list_a)):
    for j in range(0, len(list_a)):
      for o in range (0, len(list_a[i])):
          for t in range(1, len(list_a[j])):
              try:
                  for x in range(0, len(list_a[i][o])):
                      for y in range(0, len(list_a[j][t])):
                          print list_a[i][o][x], "i=",i, "o=",o, "x=",x
                          print list_a[j][t][y], "j=",j, "t=",t, "y=",y
              except IndexError:
                  print ""
  </code></pre>
  
  <p>This one fails cause it compares its own items to its own items. Surely there's a better way to do this rather than putting a lot of forloops inside each other.</p>
  
  <p>And also, i need it to signal me, when it encounters CB. This would be easy if it looped right. Oh, and that "try" over there can be removed i guess. I'm sure this is easy as pie, but i just can't figure it out right now.</p>