运维网's Archiver
论坛
›
Python
› python 删除list中重复元素
eqwq
发表于 2014-7-10 10:40:06
python 删除list中重复元素
list =
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
页:
[1]
查看完整版本:
python 删除list中重复元素