2015-10-20 36 views

回答

2
my_list = [[3, 0, 2, 1, 5, 4], [5, 2, 1, 3, 0, 4]] 
rande = 3 # for this example 
distances = [len(L) - L.index(rande) -1 for L in my_list] 
1
LL = [[3, 0, 2, 1, 5, 4], [5, 2, 1, 3, 0, 4]] 

range for 5 

>>> list(map(lambda x: len(x) - x.index(5) -1,LL)) 

[1, 5] 
相關問題