title: python: compare two lists and return matches in order
body: <p>I have two lists of unequal length and I would like to compare and pull matched values in the order from the first list, so a in this example. </p>
  
  <pre><code>a = ['a','s','d','f']
  b = ['e','d','y','a','t','v']
  </code></pre>
  
  <p>expected output:</p>
  
  <pre><code>['a','d']
  </code></pre>
  
  <p>I was doing it like this but I forgot that set doesnt retain the order! how can I edit my code below to retain the order. </p>
  
  <pre><code> set(a).intersection(b)
  </code></pre>
  
  <p>Linked to this <a href="https://stackoverflow.com/questions/1388818/how-can-i-compare-two-lists-in-python-and-return-matches">How can I compare two lists in python and return matches</a></p>