How to sort a list of strings?

后端 未结 11 1001
孤独总比滥情好
孤独总比滥情好 2020-11-22 11:22

What is the best way of creating an alphabetically sorted list in Python?

11条回答
  •  暖寄归人
    2020-11-22 11:56

    Or maybe:

    names = ['Jasmine', 'Alberto', 'Ross', 'dig-dog']
    print ("The solution for this is about this names being sorted:",sorted(names, key=lambda name:name.lower()))
    

提交回复
热议问题