列表去重(保持原来的顺序)
from functools import reduce
list1 = [1,4,3,3,4,2,3,4,5,6,1]
func = lambda x,y:x if y in x else x + [y]
list2=reduce(lambda x,y:x if y in x else x + [y], [[], ] + list1)
print(list2)
print(list1)
其他方法:
https://www.cnblogs.com/zknublx/p/6042295.html
列表去除元素长度小于等于1的元素
a = ['what', '1', 'a', 'some', 'b', 'time']
a = [i for i in a if len(i) > 1]
print(a)
输出
['what', 'some', 'time']