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