This is probably a simple question that I just skip, but I have two lists containing strings, and I want to βbounceβ one, element by element, and the other back. I expect that there will be many matches and you will want all the indexes. I know that list.index () gets the first, and you can easily get the last. For example:
list1 = ['AS144','401M','31TP01'] list2 = ['HDE342','114','M9553','AS144','AS144','401M']
Then I will iterate over list1 compared to list2 and output:
[0,0,0,1,1,0] , [3,4] or the like. for the first iteration [0,0,0,0,0,1] , [6] for the second and [0,0,0,0,0,0] or [] for the third
EDIT: Sorry for any confusion. I would like to get the results in such a way that I can use them as follows: I have a third list that allows list3 to be called, and I would like to get the values ββfrom this list in the output indexes. those. list3[previousindexoutput]=list of cooresponding values
Kosig
source share