>>> names = ["john", "hack", "blank"] >>> abc = sorted(names) >>> abc ['blank', 'hack', 'john'] >>> abcd = sorted(names, reverse=True) >>> abcd ['john', 'hack', 'blank']
默认是reverse=False 升序
>>> names = ["john", "hack", "blank"] >>> abc = sorted(names) >>> abc ['blank', 'hack', 'john'] >>> abcd = sorted(names, reverse=True) >>> abcd ['john', 'hack', 'blank']
默认是reverse=False 升序