【发布时间】:2016-12-23 01:13:04
【问题描述】:
我有两个列表
a = [1.1, 2.2, 5.6, 7.8,7.8, 8.6,10.2]
b = [2.2, 1.4, 1.99, 7.88, 7.8]
我希望比较两个列表以及参考列表 a 传递相同值的实体的索引。列表 a 中可以有多个匹配项。
结果是
c= [1,3,4] # with reference to a as 2.2 occur at location 1, 7.8 at location 3 and 4.
我发现了一个类似的问题,但如果没有捕获多次点击!并且第一个接受的答案不会打印索引!循环中没有打印。
compare two lists in python and return indices of matched values
问候,
【问题讨论】:
标签: python list comparison