Printing all the values from multiple lists at the same time

后端 未结 7 1887
遥遥无期
遥遥无期 2020-12-19 05:02

Suppose I have 3 lists such as these

l1 = [1,2,3]
l2 = [4,5,6]
l3 = [7,8,9]

how do I get to print out everything from these lists at the s

7条回答
  •  感情败类
    2020-12-19 05:45

    If you want to print

    1 4 7
    2 5 8
    3 6 9
    

    Do:

    for i,j,k in zip(l1,l2,l3):
        print i,j,k
    

提交回复
热议问题