How to sort a list of strings in Python?

Posted by Editorial Staff | Updated on

Want to sort a list of strings using Python programming language. Use the following example:

This modifies your original list (i.e. sorts in-place). To get a sorted copy of the list, without changing the original, use the sorted() function:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers