Python Comparing Lists -


i want compare 2 lists , want know if element corresponds element.

example: 'a' should correspond 'b' here, return true.

list1 = [a,b,c,d] list2 = [b,a,d,c] 

'a' , 'b' correspond each-other (they share same spot on lists). how make function return true if correspond?

list1 = [a,b,c,d] list2 = [c,d,a,b] 

this return false.

i this:

>>> operator import eq >>> list1 = ['a','b','c','d'] >>> list2 = ['c','d','a','b'] >>> any(map(eq, list1, list2)) false 

of course, if want full boolean 'correspondence' list can omit any function:

>>> map(eq, list1, list2) [false, false, false, false] 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -