keep_bool = np.sum([a==i for i in b], axis=0)
keep_indices = np.where(keep_bool)[0]
print(keep_bool)
return keep_indices
keep_bool = np.sum([a==i for i in b], axis=0)
keep_indices = np.where(keep_bool)[0]
print(keep_bool)
return keep_indices
本文标题:python判断两列表的相同元素,并返回索引
本文链接:https://www.haomeiwen.com/subject/dbsuxctx.html
网友评论