Answers for "two lists with identical entries get order"

0

two lists with identical entries get order

from collections import defaultdict, deque

indexes = defaultdict(deque)
for i, x in enumerate(lst2):
    indexes[x].append(i)

ids = [indexes[x].popleft() for x in lst1]
Posted by: Guest on April-04-2022

Code answers related to "two lists with identical entries get order"

Python Answers by Framework

Browse Popular Code Answers by Language