python 去重

2021-09-14  本文已影响0人  铁甲依然在人间
list =[1,2,3,4,3,6,3]
# #
# def count1(x,list):
#     list1= [ i for i in list if i ==x ]
#     return len(list1)
#
# print(count1(3,list))

def rep(list):
    temp=[]
    [temp.append(i) for i in list if i not in temp]
    return temp

print(rep(list))
上一篇下一篇

猜你喜欢

热点阅读