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()))