201

版权声明:根号v587版权所有 https://blog.csdn.net/hcmdghv587/article/details/82595069
def newzip(*args):
    result = []
    if len(args) > 0:
        lens = list(map(len, args))
        maxL = max(lens)
        for i in range(maxL):
            temp = []
            for j in args:
                if i < len(j):
                    temp.append(j[i])
                else:
                    temp.append(None)
            result.append(temp)
    return result

print(newzip([1, 2], ['a', 'b', ('c', 'd')]))
print(newzip([1,2],[3, 4],[5, 6, 7]))

猜你喜欢

转载自blog.csdn.net/hcmdghv587/article/details/82595069
201