Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python List sort() Method
Description:
This method sorts objects of list, use compare func if given.
Syntax:
Parameters:
Here is the detail of parameters:
Return Value:
It returns none but sort the given object from the list.
Example:
#!/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']
|
|
|
|