[Python] get row and column of matrix

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I wonder where how to get row and column of this matrix. I want to loop through each element[row][column], but I have no idea how to get these.

    imaginary_axis = 100
    real_axis = 1

    mixed_matrix = [[0 for j in xrange(imaginary_axis)] for i in xrange(real_axis)]

    for row in mixed_matrix[0]:
    print(row)
    for column in mixed_matrix:
    print(column)
    check(mixed_matrix[row][column])


    This throws an error. How can I get this to work?

    TypeError: list indices must be integers, not list


    I know why I get this error, but I do not know how I can get the column right.

    Continue reading...

Compartilhe esta Página