728x90
두 개의 데이터 원소를 각각 tuple 로 짝지어줌
Transpose 로 볼 수도 있음
>>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):
print(item)
(1, 'sugar')
(2, 'spice')
(3, 'everything nice')
# unzip
>>> *zip
두 개의 데이터의 길이가 같지 않다면 길이가 짧은 데이터 기준으로 stop
728x90
'Code & Framework > Python Numpy' 카테고리의 다른 글
[Python] 코딩테스트용 함수 모음 (eval, map, join, split, upper, lower, iter, next, replace, list, dict, itertools, counter, deque) (0) | 2024.04.04 |
---|---|
[Python] 내장함수 list() (0) | 2023.06.19 |