📜  按长度排序列表python代码示例

📅  最后修改于: 2022-03-11 14:45:35.783000             🧑  作者: Mango

代码示例1
#Input
def sort():
    lst = [orange, ant, phone, banana, notebook)
    lst2 = sorted(lst, key=len)
    return lst2
           
#Output : [ant, phone, banana, orange, notebook)