python sort of two-dimensional method using a sorted list

list3 = [['1', '15', '8'], ['1', '14', '2'], ['1', '15', '9'], ['1', '14', '3'], ['1', '16', '0'], ['1', '15', '1'],
          ['1', '16', '2'], ['1', '15', '10'], ['1', '16', '3'], ['1', '15', '12']]


DEF sort3 (List1): 
  # sort the list of numbers List2 = the sorted (List1, Key = (the lambda X: [X [0], X [. 1], X [2 ]]))
  # a one-dimensional list of the interior of the lower main element labeled 0, the subscript 1 is an element time, subscript 2 is an element most times, sorting Print (List2) return List2 DEF to_int (slist):
  # the list of strings into digital list num_list = [] for I in slist: = R & lt Map (the eval, I) num_list.append (List (R & lt)) Print (num_list) return num_list

num_list2 = to_int(list3)
sort3(num_list2)

 

Guess you like

Origin www.cnblogs.com/weisunblog/p/12421882.html