python-列表删除重复项使用集合

91 阅读1分钟
>>> l=[1,2,1,3,2,4,5]
>>> set(l)
{1, 2, 3, 4, 5}
>>> l=list(set(l))
>>> l
[1, 2, 3, 4, 5]
>>>