2011-04-26

Python: how to remove duplicates from list

# -*- coding: utf-8 -*-
qi=[1,1,3,1,6,4,5,1,6] #some elements repeat
qi.sort() #sort urls (just for fun)
qi_normal=set(qi) #this removes duplicate URL's
print "list wit repeated elemnts:", qi
print "list without repeted ellemnts:",qi_normal

Комментариев нет:

Отправить комментарий