You can download this code by clicking the button below.
This code is now available for download.
The function takes multiple iterable objects as arguments and combines them into tuples. The return value is an iterator that produces a sequence of these tuples. If the input iterables have different lengths, the shortest input iterable determines the number of iterations.
Technology Stack : Built-in library - zip
Code Type : Function
Code Difficulty : Intermediate
def zip(*iterables):
"""
将可迭代对象组合成元组,按最短输入迭代。
"""
zip_obj = zip(*iterables)
return [tuple(e) for e in zip_obj]