리스트에서 중복된 원소 삭제

if len(list) > 1:
  list.sort()

  last = list[-1]

  for i in range(len(list)-2,-1,-1):
    if last == list[i]:
      del list[i]
    else:
      last=list[i]


리스트에 존재하는 중복되는 항목을 삭제


Python Grimoire 중에서...


Comment 달린것입니다.
tempDic = {}
   if len( list ) > 1:
      list.sort() for i in list:
         tempDic[i] = ''
         print tempDic.keys()
크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by gwlee

2008/08/25 02:32 2008/08/25 02:32
Response
0 Trackbacks , 0 Comments
RSS :
http://thegreatgoodplace.com/tt/study/rss/response/41

Trackback URL : http://thegreatgoodplace.com/tt/study/trackback/41

Leave a comment
« Previous : 1 : ... 13 : 14 : 15 : 16 : 17 : 18 : 19 : 20 : 21 : ... 55 : Next »