-
list 원소의 중복 제거Python/개념학습 2022. 10. 27. 14:55
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'c', 'd' ] alpha = list(set(alpha)) print(alpha) # 출력 : ['a', 'b', 'c', 'd', 'e', 'f', 'g']
2차원 리스트에서 중복 제거는 ?
lst = [[1,2], [1,2], [1]] print(list(set(map(tuple, lst))))
'Python > 개념학습' 카테고리의 다른 글
문자열의 정렬 (0) 2022.11.05 순열(permutations)과 조합(combinations) (0) 2022.11.04 map함수 활용 (0) 2022.10.27 Meaning of stack[-1][0] (0) 2022.08.24 collections 모듈 - extend, append (0) 2022.08.21