Is there a built in function that compares two or more lists and returns elements common to all?
like this:
def in_both( list_a, list_b ):
list_c=[]
for value in list_a:
for value in list_a:
if value in list_b:
list_c.append(value)
return list_c
Or this:
def in_all(list_of_lists):
list_a = list_of_lists.pop(0)
list_b = []
for value in list_a:
in_all_lists = True
for each_list in list_of_lists:
if not value in each_list:
in_all_lists = False
if in_all_lists:
list_b.append(value)
return list_b
Thank you
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bf2cf505-6205-4fcf-affd-9a0a2f7e5e00n%40googlegroups.com.
No comments:
Post a Comment