Find the dimensions of a multidimensional Python array
No, there’s nothing built-in because with such “arrays”1 it can be jagged and the concept of “dimensions” or “shape” doesn’t make any sense at all. So, you’ll have to write your own. If you can make an assumption of uniformity along all dimensions, you can proceed as follows: dim1 = len(a) dim2 = len(a[0]) dim3 … Read more