Skip to main content
Biohacker
  • About
  • Archive
  • Tags
  • RSS feed

    파이썬 리스트 중복 아이템 제거

    Taeyoon Kim

    2013-05-06 17:30

    Python의 리스트에 중복된 아이템은 아래와 같은 방법으로 쉽게 제거할 수 있습니다.

    #리스트 생성과 확인
    li = ["a","b","c","d","a","b"]
    print('li')
    
    ["a","b","c","d","a","b"]
    
    #리스트에 중복 아이템 제거
    li = list(set(li))
    print(li)
    
    ['a', 'c', 'b', 'd']
    
    • Python
    • Previous post
    • Next post
    Contents © 2024 Taeyoon Kim - Powered by Nikola

    Search Results: