Python list method sort() sorts objects of the list, use compares func if given.
Following is the syntax for sort() method -
list.sort([func])
This method does not return any value but it changes from the original list.
The following example shows the usage of sort() method.
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 'xyz']; aList.sort(); print "List : ", aList
When we run the above program, it produces the following result
List : [123, 'abc', 'xyz', 'xyz', 'zara']
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.