python get difference from arrays
<p>I have the following two arrays , i am trying to see whether if the elements in invalid_id_arr exists in valid_id_arr if it doesn't exist then i would form the diff array.But from the below code i see the following in diff array <code>['id123', 'id124', 'id125', 'id126', 'id789', 'id666']</code>, i expect the output to be <code>["id789","id666"]</code> what am i doing wrong here</p>

<pre><code>tag_file= {}
tag_file['invalid_id_arr']=["id123-3431","id124-4341","id125-4341","id126-1w","id789-123","id666"] 
tag_file['valid_id_arr']=["id123-12345","id124-1122","id125-13232","id126-12332","id1new","idagain"] 
diff = [ele.split('-')[0] for ele in tag_file['invalid_id_arr'] if str(ele.split('-')[0]) not in tag_file['valid_id_arr']]
</code></pre>

<p>Current Output:</p>

<pre><code> ['id123', 'id124', 'id125', 'id126', 'id789', 'id666']
</code></pre>

<p>Expected ouptut:</p>

<pre><code> ["id789","id666"]
</code></pre>
