title: How to compare lists in Python for partial matches?
body: <p>I apologise if this question is badly phrased.</p>
  
  <p>My script is running comparisons on trade messages, written as string values, and I wish to see if there are fields appearing in one messages, but not another. An example of the two messages being used are:</p>
  
  <pre><code>msg1 = ['35=D', '52=20160429', '11=0001A', '44=440', '15=EUR']
  msg2 = ['35=D', '52=20160428', '11=0001B', '44=439', '15=EUR']
  </code></pre>
  
  <p>To compare the lists, I am using:</p>
  
  <pre><code>result = [o for o in a if o not in b]
  </code></pre>
  
  <p>Right now, my script is providing me with elements that do not <em>exactly</em> match, so for example:</p>
  
  <pre><code>nonmatches = ['52=20160428', '11=0001B', '44=439']
  </code></pre>
  
  <p>This will not work for me, as the tags are still present in both messages. So my question is - how would I compare the two lists after the first three characters of each element? </p>