The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.
If the passed iterators have different lengths, the iterator with the least items decides the length of the new iterator.
a = ("John", "Charles", "Mike")
b = ("Jenny", "Christy", "Monica")
x = zip(a, b)
아래 명령을 반복할 때마다 튜플값이 쌍으로 차례로 나온다.
next(iter(x))
('John', 'Jenny')
('Charles', 'Christy')
('Mike', 'Monica')
댓글
댓글 쓰기