Python Function: Merging Iterables into Tuples

  • Share this:

Code introduction


This function merges multiple iterable objects into a list of tuples and returns an iterator. For example, zip([1, 2], ['a', 'b']) returns [(1, 'a'), (2, 'b')]。


Technology Stack : zip

Code Type : Function

Code Difficulty :


                
                    
def zip(*args):
    """将可迭代对象合并为元组,然后返回迭代器"""
    return zip(*args)                
              
Tags: