On 24 April 2012 12:06, S Pratap Singh <[email protected]> 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.
Please do not do that when you are presenting things as code, or at least say what you mean. > Let me know if this makes sense to you. Not completely. How is your desired sort order of [ *"alAN"*, "aLaN", "aLAn", "AlaN", "AlAn", "ALan", "alaN", "alAn", "aLan", "Alan" ] defined? I cannot see a logic to the order. Regards, Gora _______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
