为什么sort排序后没效果?
ls = ls.sort
是要按键值对的值排序么?不是你这样写的 sort() 是方法吧 你那个应该是 ls.sort()
sorted(ls)或者ls.sort(key=lambda x :x[0]),x[0]表示已元组第一位为key