Python代码实现删除一个list里面的重复元素

lst=[11,22,33,44,22,11,22,44]
print(list(set(lst)))
# 打印结果:[33, 11, 44, 22]

d = {}
for index,item in enumerate(lst,1):
    d[item]=index
# 打印字典
print(d)
# 打印字典所有key
print(d.keys())
# 将所有key转换成一个列表
print(list(d.keys()))
原文地址:https://www.cnblogs.com/apollo1616/p/9776700.html