a_list = ["aaa", "cc", "bb"] new_list = sorted(a_list, key=lambda x: (len(x), x)) #Sort by length then alphabetically print(new_list) #OUTPUT #>>['bb', 'cc', 'aaa']