finding different words in two lists
<p>i have two list and i want to delete the matching one and keep the different.
here is the code:</p>

<pre><code>def check_synonym(text):
     tokens=regexp_tokenize(text, r'[ØØ!.Ø\s+]\s*', gaps=True)
     based_text= ' '.join(cursor.execute('SELECT request FROM Male_Conversation_Engine WHERE request REGEXP?',[tokens[0]]).fetchone())
     based_tokens=regexp_tokenize(str(based_text), r'[ØØ!.Ø\s+]\s*', gaps=True)
    for w1 in based_tokens:
       for w2 in tokens:
           if w1 == w2:
              based_tokens.remove(w1),tokens.remove(w2)      
return list
</code></pre>

<p>if the two list are "in Arabic":</p>

<pre><code> tokens = ['ÙØ°Ø§','Ø§ÙØ¬ÙØ§Ø²','Ø§ÙØ¬ÙÙÙ']
 based_tokens = ['ÙØ°Ø§','Ø§ÙØ¬ÙØ§Ø²','Ø¬ÙØ¯']
</code></pre>

<p>the Output should be:</p>

<pre><code> tokens = ['Ø§ÙØ¬ÙÙÙ']
 based_tokens = ['Ø¬ÙØ¯']
</code></pre>

<p>the actual Output:</p>

<pre><code> tokens = ['Ø§ÙØ¬ÙØ§Ø²','Ø¬ÙÙÙ']
 based_tokens = ['Ø§ÙØ¬ÙØ§Ø²','Ø¬ÙØ¯']
</code></pre>

<p>the side only delete the first element 'ÙØ°Ø§' and return the rest of the list.</p>

<p>(using python3)</p>

<pre><code>    set1=set(tokens)
    set2=set(based_tokens)

    tokens = set1-set2 
    based_tokens = set2-set1
</code></pre>

python