Print a nested list line by line - Python

后端 未结 7 1537
-上瘾入骨i
-上瘾入骨i 2020-12-15 12:51

A = [[1, 2, 3], [2, 3, 4], [4, 5, 6]]

I am trying my best to print A of the form:

1 2 3
2 3 4
4 5 6

That

7条回答
  •  温柔的废话
    2020-12-15 13:26

    print without trailing comma will print a newline character.

    for r in A:
        for t in r:
            print t,
        print
    

提交回复
热议问题