从List,Tuples和Dictionary中删除重复数据 [英] Removing the duplicate data from List,Tuples and Dictionary

查看:88
本文介绍了从List,Tuples和Dictionary中删除重复数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如何从列表,元组和字典中删除重复的数据?


提前谢谢

PSB

Hi,

How to remove the duplicate data from List,Tuples and Dictionary?.

Thanks in advance
PSB

推荐答案




例如:


list1 = [[1,0,0],[0,1,0],[1,1,0],[0,0,0],[1,1,0]]


我不希望列表中有重复的值


输出必须如下所述


list1 = [[1,0,0],[0,1,0],[1,1,0],[0,0,0]]


谢谢&问候

PSB
Hi ,

For example :

list1 = [ [1,0,0],[0,1,0],[1,1,0],[0,0,0],[1,1,0]]

I dont want to have the duplicate values in the list

the output has to be as mentioned below

list1 = [ [1,0,0],[0,1,0],[1,1,0],[0,0,0]]

Thanks & Regards
PSB






例如:


list1 = [[1,0,0],[0,1,0],[1,1,0],[0,0,0],[1, 1,0]]


我不希望列表中有重复的值


输出必须如下所述


list1 = [[1,0,0],[0,1,0],[1,1,0],[0,0,0]]


谢谢&问候

PSB
Hi ,

For example :

list1 = [ [1,0,0],[0,1,0],[1,1,0],[0,0,0],[1,1,0]]

I dont want to have the duplicate values in the list

the output has to be as mentioned below

list1 = [ [1,0,0],[0,1,0],[1,1,0],[0,0,0]]

Thanks & Regards
PSB



因为列表中的项目是不可用的,所以它有点复杂:

Since the items in the list are unhashable, it''s a bit more complicated:

展开 < span class =codeDivider> | 选择 | Wrap | Line数字



由于列表中的项目不可删除,因此它有点复杂:
Since the items in the list are unhashable, it''s a bit more complicated:
展开 | 选择 | Wrap | 行号


这篇关于从List,Tuples和Dictionary中删除重复数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆