David HláÄik wrote:
Steven's example works but it won't scale for large lists. Sets are much
faster if you don't require an ordered result.
set(['hello'])
['hello']
Christian
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.
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.
faster if you don't require an ordered result.
>>list_curren t = [ "welcome", "search", "done", "result"]
>>list_ldap = [ "welcome", "hello"]
>>diff = set(list_ldap). difference(set( list_current))
>>diff
>>list_ldap = [ "welcome", "hello"]
>>diff = set(list_ldap). difference(set( list_current))
>>diff
>>list_toadd = list(diff)
>>list_toadd
>>list_toadd
Christian