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

 

相关文章:

  • 2021-07-29
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2021-07-16
  • 2021-10-22
  • 2022-02-07
  • 2021-10-23
  • 2022-12-23
相关资源
相似解决方案