How to sort a list in Python? Python Add comments Jul 012010 How to sort a list in Python? Answer: Use the sorted method. list = [3, 2, 1] print sorted(list) It will give: [1, 2, 3] Related posts: Sort numerical value using the sort command How to modify a single character in a string in Python? List 10 most often used commands How to debug in Python? How to perform syntax check for Python program Leave a Reply Cancel reply Name (required) E-mail (required) URI Your Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>