Skip to content Skip to sidebar Skip to footer

Finding The Indices Of The Values Of One List In Another List

I have two Python lists of integers: x, and y. All elements of x appear somewhere in y, and only once. For each element of x, I want to know the index of the corresponding value in

Solution 1:

Here is one way to do it:

z = [y.index(i) for i in x]

Post a Comment for "Finding The Indices Of The Values Of One List In Another List"