例如,给定列表 ['one', 'two', 'one']
,算法应该返回 True
,而给定 [' one', 'two', 'three']
它应该返回 False
。
最佳答案
如果所有值都是 hashable,则使用 set()
删除重复项:
>>> your_list = ['one', 'two', 'one']
>>> len(your_list) != len(set(your_list))
True
关于python - 如何检查平面列表中是否有重复项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1541797/