In Python, is it possible to write a function that returns the dimensions of a multidimensional array (given the assumption that the array's dimensions are not jagged)?
For example, the dimensions of [[2,3], [4,2], [3,2]]
would be [3, 2]
, while the dimensions of [[[3,2], [4,5]],[[3,4],[2,3]]]
would be [2,2,2]
.
Does Python have any built-in functions that will return all of the dimensions of a multidimensional array, or will I need to implement this function myself?
[[1,2],[3,4,5]]
? Or[[1,2],[3,4],[5,[6,7]]]
? – Scopas