Sort elements in a list : List Sort « List « Python
- Python
- List
- List Sort
Sort elements in a list

L = ['spam', 'Spam', 'SPAM!']
print L.append('please') # append method call
print L
L.sort() # sort list items ('S' < 'e')
print L
Related examples in the same category