[Python] List of lists (double [[) in Python

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    This is a really basic thing but after reading the documentation I am still not able to do. I just want to create a list of 9 sublists as follows

    [[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25]]


    I am doing

    [np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05),
    np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05),
    np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05), np.arange(0, 25.05, 0.05)]


    but I get 24.9 , 24.95, 25. ])], while I would like to get 24.9 , 24.95, 25. ]])]. How can I get this done?

    Continue reading...

Compartilhe esta Página