> Hello ,
> following scenario
>
> list_current = [ "welcome", "search", "done", "result"]
> list_ldap = [ "welcome", "hello"]
>
> result:
>
> list_toadd = [ "hello"]
>
> by words said , i want to check if list item from list_ldap exists in
> list_current if not i want to add it to list_toadd.
>
> Thanks!
>
> D.

list_toadd = [i for i in list_ldap if i not in list_current]
seems to work.

I'm sure there's a way to do it with set objects as well.
-Steven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to