[英]searching index of tuple from list of tuples
我有一个元组列表如下:
tupleList = [('a','b'), ('c','d'), ('a','b'), ('a','b'), ('e','f')]
我想在tupleList中找到('a','b')
的索引。
我正在尝试以下方法:
idx = np.where(tupleList == ('a','b'))
但它给出了一个空数组。
期望的输出将是
idx = [0, 2, 3]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.