def set_alone(data_):
    dict_result = {}
    for item in data_:
        dict_result.update({item: ""})
    print("未去重数量{},去重后数量{}".format(len(data), len(dict_result)))


if __name__ == '__main__':
    data = [22, 2, 2, 2, 1, 1]
    set_alone(data)

参考:https://blog.csdn.net/weixin_43799652/article/details/93219030

如图:

python利用字典去除列表里面的重复数据

 

 元祖数据存到字典里面:

python利用字典去除列表里面的重复数据

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-08-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2022-01-06
  • 2022-01-07
  • 2022-12-23
相关资源
相似解决方案