Iterate multiple lists all at once

Use zip and for-loop
Example:

a = ["a", "b", "c"]
b = [1, 2, 3]

for e1, e2 in zip(a, b):
    print(e1, e2)             

Output:

a 1
b 2
c 3

原文链接:Iterate multiple lists all at once

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容