Copyright © tutorialspoint.com
This method sorts objects of list, use compare func if given.
list.sort([func]) |
Here is the detail of parameters:
func: optional parameter, if given the it would use that function to sort the objects of the list.
It returns none but sort the given object from the list.
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 'xyz']; aList.sort(); print "List : ", aList; |
This will produce following result:
List : [123, 'abc', 'xyz', 'xyz', 'zara'] |
Copyright © tutorialspoint.com