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

S Pratap Singh kdarious at gmail.com
Tue Apr 24 11:43:24 CEST 2012


Yeah this is what i thought but this sorting needs to be done using the
Initial name not the first name of persons ..I am getting little confused
and I am very new to python and worked on python almost 3 years back so
finding problem with striping and sorting ..


On Tue, Apr 24, 2012 at 2:40 AM, Anand Chitipothu <anandology at gmail.com>wrote:

> 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?
>
> Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
Regards,
Pratap Singh


More information about the BangPypers mailing list