Key sort : Sort « List « Python Tutorial






caseList = ['d', 'B', 'F', 'A', 'E', 'c']


print caseList
caseList.sort()
print caseList
caseList.sort(key=str.lower)
print caseList








7.24.Sort
7.24.1.The sort method is used to sort lists in place.
7.24.2.sort the elements according to their lengths
7.24.3.the list should be sorted in reverse:
7.24.4.Sorting a List
7.24.5.Key sort
7.24.6.Reverse sort