[Python] Sorting Numerical String Values of List based on two columns Python

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have a list that contains two columns named as TimeCount and FRAME. I want to sort the two columns based on TimeCount first, then FRAME.

    I used sort() function to sort the list and it works correctly other than it captures 10 as 1 because the column contains String numerical values.

    # Find common parts
    intersection = list(set(csv_1) & set(csv_2) & set(csv_3))

    # Sort the list
    intersection.sort()


    As you can see from the row number 11 to 13, the second column has 0, 10, 2 as sorted values. I tried to use sort(key = int), but the first column prevents it because of ':' symbol. I want to sort the second column correctly.

    Continue reading...

Compartilhe esta Página