how to get the length of a matrix in python code example
Example 1: length of a matrix in python
matrix = [[1, 2]]
rows = len(matrix) # Height.
columns = len(matrix[0]) # Width.
print(rows)
print(columns)
Example 2: python check matrix dimension
>>> a.shape
(2, 2)