Discuss / Python / tuple lambda排序

tuple lambda排序

Topic source

雨夜桦

#1 Created at ... [Delete] [Delete and Lock User]

print("lambda表达式按名字排序",sorted(L,key=lambda x:x[0]))

print("lambda表达式按成绩从高到低排序:",sorted(L,key=lambda x:x[1],reverse=True))


  • 1

Reply