Discuss / Python / liangshui

liangshui

Topic source

田俊俊

#1 Created at ... [Delete] [Delete and Lock User]
L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]
print(sorted(L, key=lambda x: x[0].lower()))
print(sorted(L, key=lambda x: x[1]))

田俊俊

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

(sorted(L, key=lambda x: x[1],reverse=True))

  • 1

Reply