Displaying python 2d list without commas, brackets, etc. and newline after every row

前端 未结 5 1830
Happy的楠姐
Happy的楠姐 2020-12-12 00:51

I\'m trying to display a python 2D list without the commas, brackets, etc., and I\'d like to display a new line after every \'row\' of the list is over.

This is my

5条回答
  •  时光说笑
    2020-12-12 01:22

    print "\n".join(" ".join(map(str, line)) for line in ogm)
    

    If you want the rows and columns transposed

    print "\n".join(" ".join(map(str, line)) for line in zip(*ogm))
    

提交回复
热议问题