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)
原文地址:https://www.cnblogs.com/Hunter-541695/p/9351003.html
时间: 2024-10-17 00:16:06