I have a list of strings that contains salutation in it. How can I sort the list on the basis of names (after salutation - Mr., Ms., Mrs.) in pythonic way?
I have tried to split the elements of list on the basis of '.' character and sorted the names but could not get salutation with sorted names.
names = ["Mr.usman", "Mrs.obama", "Mr.Albert"]
sorted_list = sorted([i.split('.')[1] for i in names])
For e.g ["Mr.usman", "Mrs.obama", "Mr.Albert"]
should be like ["Mr.Albert", "Mrs.obama", "Mr.usman"]
Any help is highly appreciated.