九州体育网 - 十年信誉网站

关于作者

Discuss / Python / 反正我是懵逼的

反正我是懵逼的

Topic source

俄罗斯雨林

#1 Created at ...

L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)]

def by_name(t): return t[0]

def by_score(t): return t[1] L2 = sorted(L, key=by_name) print(L2) L2 = sorted(L, key=by_score, reverse=True) print(L2)


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.