[Python] Transpose list of lists

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    Suppose I have

    l = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]


    How can I get a result like so?

    r = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]


    I know how to get

    r = [(1, 4, 7), (2, 5, 8), (3, 6, 9)]


    but I must have lists as elements of the result.

    Continue reading...

Compartilhe esta Página