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

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 : ... 98 : 99 : 100 : 101 : 102 : 103 : 104 : 105 : 106 : ... 137 : Next »

블로그 이미지

Stay Hungry Stary Foolish!

- gwlee

TC-Cumulus by reznoa requires Flash Player 9 or better.

Site Stats

Total hits:
62336
Today:
17
Yesterday:
65