-
[Python] zip(*iterable)Engineering WIKI/Python 2020. 11. 11. 06:28
matrix = [[1,2,3],[4,5,6]] print(list(map(list, zip(*matrix)))) ''' OUTPUT : [[1,4], [2,5], [3,6]] '''
zip()을 연산자 * 와 함께 쓰면 리스트를 언집(uzip) 할 수 있다.
'Engineering WIKI > Python' 카테고리의 다른 글
[Python] pyinstaller 실행파일 생성 (0) 2021.02.21 Pandas 텍스트(txt) 파일 불러오기 및 저장하기 (0) 2021.02.03 [Python] 소요시간 측정방법 (0) 2020.12.09 [Python] Coding Test Tip (0) 2020.12.09 [Python] f-string (0) 2020.04.18 [Python] 리스트 문자열 합치기 .join() (0) 2020.03.29 [Python] 파이썬 에러 pip upgrade fail, 'NoneType' object has no attribute 'bytes' (0) 2020.03.09 [Python] lambda (0) 2020.02.16