首页 > 代码库 > python 删除list中重复元素

python 删除list中重复元素

list = [1,1,3,4,6,3,7]

  1.

for s in list:    if list.count(s) >1:        list.remove(s)

  2.

list2=[]for s in list:    if s not in list2:        list2.append(s)print list2

  3.

list2=[]for s in list:    list2.append(s)print list2