Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Sorting a List

📅 2010-Feb-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

alist = [10, 2, 8]

# Returns sorted list of input list
blist = <strong><a href="http://docs.python.org/library/functions.html#sorted">sorted</a></strong>(alist)

# In-place sort of list
alist.<strong>sort</strong>()