sorting a list

Daniel Yoo dyoo at
Wed Mar 10 03:06:46 CET 2004

ketulp_baroda at wrote:
: Hi
: I want to sort a list.
: My problem is:

:>>> a=['a','f','F','A','D']
:>>> a.sort()
:>>> a
: ['A','D', 'F', 'a', 'f']

: But I am actually looking for an output:
: ['A','a','D','F','f']

: Is there any module to sort a list this way?

Hi Ketulp,

Yes, Python's lists do have a sort() method that we can use to do
sorting.  If you're like to learn more, there's a great Sorting HOWTO
by Andrew Dalke that should be helpful:

Hope this helps!

More information about the Python-list mailing list