mylist = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
如何打印列表与指定的列宽
例如,我想打印column = 5
则新行
print(mylist, column= 5)
[ 1, 2, 3, 4, 5,
6, 7, 8, 9, 10,
11, 12, 13, 14, 15,
16, 17, 18, 19, 20]
或者我想要的清单打印column = 10
then new line
print(mylist, column= 10)
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
我知道我可以使用for-loop来做到这一点,但我想知道是否有这样做的功能呢?
很酷,我不知道'reshape'接受-1作为参数。更多信息在这里:https://stackoverflow.com/questions/18691084/what-does-1-mean-in-numpy-reshape – timgeb
感谢您的链接 – Eliethesaiyan