title: Sorting a list of dictionaries based on the order of values of another list
body: <p>I'm using python 2.7.3, and I'm trying to sort a list of dictionaries based on the order of values of another list.</p>
  
  <p>IE:</p>
  
  <pre><code>listOne = ['hazel', 'blue', 'green', 'brown']
  listTwo = [{'name': 'Steve', 'eyecolor': 'hazel', 'height': '5 ft. 11 inches'},
             {'name': 'Mark', 'eyecolor': 'brown', 'height': '6 ft. 2 inches'},
             {'name': 'Mike', 'eyecolor': 'blue', 'height': '6 ft. 0 inches'},
             {'name': 'Ryan', 'eyecolor': 'brown', 'height': '6 ft, 0 inches'},
             {'name': 'Amy', 'eyecolor': 'green', 'height': '5 ft, 6 inches'}]
  </code></pre>
  
  <p>Sorting listTwo based off of the order of values in listOne, we would end up with the following:</p>
  
  <pre><code>print listTwo
  [{'name': 'Steve', 'eyecolor': 'hazel', 'height': '5 ft. 11 inches'},
  {'name': 'Mike', 'eyecolor': 'blue', 'height': '6 ft. 0 inches'},
  {'name': 'Amy', 'eyecolor': 'green', 'height': '5 ft, 6 inches'},
  {'name': 'Mark', 'eyecolor': 'brown', 'height': '6 ft. 2 inches'},
  {'name': 'Ryan', 'eyecolor': 'brown', 'height': '6 ft, 0 inches'}]
  </code></pre>
  
  <p>I eventually need to output this text, so what I've done to display it correctly (in the correct order) is the following:</p>
  
  <pre><code>for x in xrange(len(listOne)):
      for y in xrange(len(listTwo)):
          if listOne[x] == listTwo[y]["eyecolor"]:
              print "Name: " + str(listTwo[y]["name"]),
              print "Eye Color: " + str(listTwo[y]["eyecolor"]),
              print "Height: " + str(listTwo[y]["height"])
  </code></pre>
  
  <p>Is there some sort of lambda expression that can be used to make this happen? There has to be a more compact, less complex way of getting it in the order I want.</p>