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
python 删除list中重复元素
时间: 2025-01-18 14:11:46