Python中判斷是一維數組仍是二維數組

若是直接用len,會發現len([1,2,4])爲5 因此採用.ndim來獲取數組維度 x = np.array([1, 2, 3, 4]) print(x.ndim) 最後答案:1web
相關文章
相關標籤/搜索