1
我想打印二維數組的元素:IndexError當試圖打印二維數組
import numpy as np
sessional=np.array([[1,2],[3,4],[5,6]])
for i in sessional:
print (sessional[i])
但是,它會導致以下錯誤:
IndexError: index 3 is out of bounds for axis 0 with size 3
我想看到下面的輸出:
[1,2]
[3,4]
[5,6]