例2.23 过滤重复值
点击查看代码
def filter_non_unique(L):
return [item for item in L if L.count(item) == 1]
a=filter_non_unique([1, 2, 2, 3, 4, 4, 5])
print(a)
print("学号:2023310143004")
def filter_non_unique(L):
return [item for item in L if L.count(item) == 1]
a=filter_non_unique([1, 2, 2, 3, 4, 4, 5])
print(a)
print("学号:2023310143004")