How to sort a list of strings?

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

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

11条回答
  •  情话喂你
    2020-11-22 11:57

    l =['abc' , 'cd' , 'xy' , 'ba' , 'dc']
    l.sort()
    print(l1)
    

    Result

    ['abc', 'ba', 'cd', 'dc', 'xy']

提交回复
热议问题