[Python] Python: How to sort X Y coordinate scan so Y start from where it end?

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

  1. Stack

    Stack Membro Participativo

    Example

    coordinate_lst = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)]


    The pattern I'm looking for after sorting is:

    [x,y] coordinate shall be sorted by y. The new list should look like:

    coordinate_lst = [(-1, -1), (-1, 0), (-1, 1), (0, 1), (0, 0), (0, -1), (1, -1), (1, 0), (1, 1)]

    Continue reading...

Compartilhe esta Página