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

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

Win32com Python


파이썬에서 좀더 다양한 윈도우 프로그래밍이 가능하게 하는 모듈?
여하튼.... 좋은거~ ㅋ

Win32com

다양한 윈도우 프로그램과 연동되어
프로그래밍을 더 시키게 만든 녀석.. ㅡ.-a

여하튼.... python 2.3이후부터는 없는줄 알았는데..
역시 sourceForge에는 있었다는...;;;

크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by gwlee

2008/08/25 01:33 2008/08/25 01:33
Response
0 Trackbacks , 0 Comments
RSS :
http://thegreatgoodplace.com/tt/study/rss/response/19

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

Leave a comment

Median 구하기



mwultong Blog


Median 구하기

a = []
a.sort
t_len = len(a)
if (t_len == 0):
   print 'None'
t_center = t_len/2
if (t_len % 2 == 1):
   print a[t_center]
else:
   print (a[t_center-1]+a[t_center]) / 2.0



문자열 순서

a = ''
a = a[::-1]
a=''.join(reversed(a))
print a






크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by gwlee

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

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

Leave a comment

KOG Category 결정 script

NCBI의 Clusters of Orthologous Groups of proteins
로컬에서도 돌리고 싶은 이유로 유사한 결과가 도출되게
짜본 스크립트 입니다.

- 지금 올려놓은 소스는 KOG ( Eukaryotic Clusters )에 해당하는 것입니다.

※ NCBI의 KOG와 결과가 완전히 일치하지는 않지만, 상당 부분 유사하게
   나옵니다. NCBI에선 어떻게 하는지는 모르겠지만, 이 script로도 유사한
   결과를 도출 할 수 있습니다. :)



Source Open



크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by gwlee

2008/08/25 01:29 2008/08/25 01:29
Response
0 Trackbacks , 0 Comments
RSS :
http://thegreatgoodplace.com/tt/study/rss/response/16

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

Leave a comment

Python tip

파이썬 마을같은 좋은 사이트도 있지만,
개인적으로 자신들만의 팁같은 것들을 올려주시는 분들이 많은 관계로.. ㅎㅎ

http://www.koreanrock.com/wiki.pl?SonDonPythonTips

http://del.icio.us/mwultong/python
크리에이티브 커먼즈 라이센스
Creative Commons License

Posted by gwlee

2008/08/25 01:27 2008/08/25 01:27
Response
0 Trackbacks , 0 Comments
RSS :
http://thegreatgoodplace.com/tt/study/rss/response/15

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

Leave a comment