Sorting a List : Sort « List « Python Tutorial






letterList = ['b', 'c', 'a', 'z', 'y', 'x']

print letterList
letterList.sort()
print letterList








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