>>> names = ["john", "hack", "blank"] >>> abc = sorted(names) >>> abc [‘blank‘, ‘hack‘, ‘john‘] >>> abcd = sorted(names, reverse=True) >>> abcd [‘john‘, ‘hack‘, ‘blank‘]
默认是reverse=False 升序
python列表排序逆序sorted reverse=True
原文:https://www.cnblogs.com/v5captain/p/14038415.html