개발 모음집/Python

[Python] zip(*iterable)

wonos 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)  할 수 있다.