如何在python3上不打印任何行

时间:2018-08-27 07:59:42

标签: python-3.x matrix-multiplication

我想在python3上这样打印

[1, 2, 3]   [3, 2, 1]   [4, 4, 4]
[4, 5, 6] + [6, 5, 4] = [10, 10, 10]
[7, 8, 9]   [9, 8, 7]   [16, 16, 16]

但是它显示如下:

[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
+
[3, 2, 1]
[6, 5, 4]
[9, 8, 7]
=
[4, 4, 4]
[10, 10, 10]
[16, 16, 16]

这是我的代码: https://codeshare.io/29rgr7

1 个答案:

答案 0 :(得分:1)

您可以在python3中传递vargs参数ot打印方法,这正是您想要的

print([1, 2, 3], [3, 2, 1], [4, 4, 4])
print([4, 5, 6], '+', [6, 5, 4], '=', [10, 10, 10])
print([7, 8, 9], [9, 8, 7], [16, 16, 16])

https://docs.python.org/3/library/functions.html#print