python列表排序逆序sorted reverse=True

>>> names = ["john", "hack", "blank"]
>>> abc = sorted(names)
>>> abc
['blank', 'hack', 'john']
>>> abcd = sorted(names, reverse=True)
>>> abcd
['john', 'hack', 'blank']

默认是reverse=False 升序

posted @ 2020-11-25 20:39  船长博客  阅读(4145)  评论(0编辑  收藏  举报
永远相信美好的事情即将发生!