veclist1 = [(0.453 , 0.232 , 0.870), (0.757 , 0.345 , 0.212), (0.989 , 0.232 , 0.543)]
veclist2 = [(0.464 , 0.578 , 0.870), (0.327 , 0.335 , 0.562), (0.757 , 0.345 , 0.212)]
equalelements = [(0.757 , 0.345 , 0.212)]
而且,如果可能的话,我只想考虑到比较中的第二个小数点 但不使它们变圆或变短。有可能吗? 提前谢谢!你知道吗
在这种情况下,我们选择
veclist1
的条目,如果只有四舍五入的条目相等。否则最后一行需要调整。你知道吗如果需要所有原始元素,则可以使用两个原始列表计算最终列表:
注意:
round
可能有issues,在当前的Python版本中应该是solved。不过,最好使用字符串:相关问题 更多 >
编程相关推荐