Home>Topic List>sort sorting function usage

sort sorting function usage

Usage of sort sorting function: 1. Sort the list. By default, the sort function sorts in ascending order, so the final output results are arranged in order from small to large; 2. Sort the tuples. By default, The sort function sorts by the size of the elements, so the final output results are arranged in order from small to large; 3. Sort the dictionary. Since the dictionary is unordered, the sorted result is still the original dictionary. Use A lambda expression is used as the value of the key parameter to specify the basis for sorting.