[BangPypers] Sort names in a list by order of importance

Anand Chitipothu anandology at gmail.com
Tue Apr 24 11:40:11 CEST 2012

On Tue, Apr 24, 2012 at 12:06 PM, S Pratap Singh <kdarious at gmail.com> wrote:

> I need to sort list with names and without loosing the alphabet case (lower
> or upper). In each list last name is important and should get priority in
> sorting. If there are two or more name similar to the last name in the
> list. Then the last name should be printed first before another similar
> names.
> Also we need to sort the name based on the initials (sir name). If the name
> does not have initial then the first name should be considered as initial.
> There are no asterisks in the list
> mylist =
> ["Alan","aLan","alAn","alaN","ALan","AlAn","AlaN","aLAn","aLaN",*"alAN"*]
> I just highlighted the last name in the list as this is very important name
> and it should be printed before any other similar name in the list.
> Let me know if this makes sense to you.

Why don't you remove the last element, sort the list and insert the removed
last element at the beginning of the list?


More information about the BangPypers mailing list