title: Python - Intersectiing strings
body: <p>Trying to write a for function that takes two strings and returns the characters that intersect in the order that they appear in the first string.</p>
  
  <p>Here's what I tried:</p>
  
  <pre><code>def strIntersection(str1, str2):
      for i in str1:
          str3 = ''
          str3 = str3.join(i for i in str1 if i in str2 not in str3)
      return str3
  
  str1 = 'asdfasdfasfd'
  str2 = 'qazwsxedc'
  
  strIntersection(str1,str2)
  
  =&gt; 'asdasdasd'
  </code></pre>
  
  <p>however I only want the the intersection characters to appear once and in order of the first string ie. 'asd'</p>
  
  <p>Can anyone help?</p>
  
  <p>I've found some similar problems on other forums but the solutions all seem to involve lists whereas I'd like my output to be a string</p>