python 列表去重

 1 a = [11,11,22,33,44,55,22,33,44]
 2 
 3 # 方法一
 4 # b = []
 5 # for i in a:
 6 #     if i not in b:
 7 #         b.append(i)
 8 # print(b)
 9 
10 f = set(a)      # 集合去重
11 b = list(f)     # 类型转换
12 print(b)

 

posted @ 2018-07-22 18:34  饭桶大叔  阅读(114)  评论(0编辑  收藏  举报